Author Topic: Lines not drawing correctly for S2  (Read 3630 times)

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Lines not drawing correctly for S2
« on: March 26, 2012, 04:29:17 am »
This maybe a problem of mine, but seems that the Galaxy S2 isn't drawing my lines for pitch maps.

-It draws the first part of the line but nothing else.
-It works fine on other phones around me.
-It fixes itself when I try OpenGL 1.1
-Lines are working fine on wagon wheels.
-AA on/off has no effect on this bug.

Any ideas why?

I'm going to hunt further for the cause of the bug, maybe get a test case going if needed. Annoying that it has to show up now when we have a release to give out in 2 hours  :-\

Edit:
Seems it's something to do with how close the camera is.
-Nothing to do with max polys.
-Nothing to do with clipping range.

Edit 2:

It looks like it has something to do with the pitch map grid itself. If I hide it:
Code: [Select]
obj.setVisibility(Object3D.OBJ_INVISIBLE);, all things are good, but if I show it, it will break the lines(any). The grid itself is is just made up of small squares with each one having a transparent texture...

Is this some kind of JPCT bug?

This my code to create each square of the pitch map grid:

Code: [Select]
private static Object3D addPlane(final String string, final String textureName, final int i, final float width, final float height, final float x, final float y, final float z, final boolean horizontal ){
final Object3D plane = GraphicsHelper.createPlane(width, height, textureName);//Primitives.getPlane(4, 2);

plane.setCulling(false);

if(horizontal){
plane.rotateX(-(float) Math.PI/2f);
}else{
plane.rotateY((float) Math.PI/2f);
}
//plane.rotateMesh();
// plane.clearTranslation();
plane.setAdditionalColor(new RGBColor(255, 255, 255));
plane.setCenter(SimpleVector.ORIGIN);
plane.translate(x+PitchMaps.xoffset, y , z + PitchMaps.PITCH_OFFSET);

// plane.translateMesh();
plane.setTransparency(5);
plane.setName(string + i);
plane.strip();
plane.build();

return plane;
}
public static Object3D createPlane(float width, float height, String texture){

SimpleVector upperLeftFront=new SimpleVector(-width/2f,-height/2f,0);
SimpleVector upperRightFront=new SimpleVector(width/2f,-height/2f,0);
SimpleVector lowerLeftFront=new SimpleVector(-width/2f, height/2f,0);
SimpleVector lowerRightFront=new SimpleVector(width/2f, height/2f,0);

int textID = TextureManager.getInstance().getTextureID(texture);

    Object3D box = new Object3D(2);
    box.addTriangle(upperLeftFront,0,0, lowerLeftFront,0,1, upperRightFront,1,0,textID);
    box.addTriangle(upperRightFront,1,0, lowerLeftFront,0,1, lowerRightFront,1,1,textID);
   
return box;
}

Edit 3:
Looks like transparency is the problem, if I don't set the texture or transparency on the squares, the lines show fine.

Blah since I have no idea on fixing this further I will have to turn off OpenGL 2.0 and release it as I don't know how many other devices this will effect.
« Last Edit: March 26, 2012, 01:07:29 pm by zammbi »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Lines not drawing correctly for S2
« Reply #1 on: March 26, 2012, 11:15:00 am »
I don't get this part:

Quote
if I don't set the texture or transparency on the squares

What does "don't set the texture" means? That is has no texture (i.e. the white dummy texture) but still is set to be transparent?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #2 on: March 26, 2012, 01:05:52 pm »
If I change the code like so:

Code: [Select]
//int textID = TextureManager.getInstance().getTextureID(texture);

    Object3D box = new Object3D(2);
    box.addTriangle(upperLeftFront,0,0, lowerLeftFront,0,1, upperRightFront,1,0);
    box.addTriangle(upperRightFront,1,0, lowerLeftFront,0,1, lowerRightFront,1,1);

and remove
Code: [Select]
plane.setTransparency(5);

I can then see the lines correctly. Having either one messes up the lines.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Lines not drawing correctly for S2
« Reply #3 on: March 26, 2012, 01:25:39 pm »
Do you have a screen shot?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #4 on: March 26, 2012, 10:37:36 pm »
Here is the screen shot(below) without the grid, showing both wagon wheel lines and pitch map lines.

[attachment deleted by admin]

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #5 on: March 26, 2012, 10:38:48 pm »
Here is the screen shot(below) with the grid lines.

As you can see the line draws a number of sections and then stops.

[attachment deleted by admin]

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #6 on: March 26, 2012, 10:46:13 pm »
Here is the screen shot(below) with no texture and transparency. The lines start working again...

[attachment deleted by admin]
« Last Edit: March 26, 2012, 10:48:39 pm by zammbi »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Lines not drawing correctly for S2
« Reply #7 on: March 27, 2012, 07:45:09 am »
Really strange. Just to be sure: If you keep transparency but don't set the texture, the lines show up too? Could you try to offset the complete line set by some amount in up-direction and post the result? I would also like to see the buggy case when viewed from the side to better understand what's going on here...

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #8 on: March 27, 2012, 08:02:49 am »
Quote
Really strange. Just to be sure: If you keep transparency but don't set the texture, the lines show up too?
They don't show.

Quote
Could you try to offset the complete line set by some amount in up-direction and post the result? I would also like to see the buggy case when viewed from the side to better understand what's going on here...
Sure thing, I'll grab the device again at work tomorrow.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Lines not drawing correctly for S2
« Reply #9 on: March 27, 2012, 09:41:56 am »
Maybe it has to do with the alpha channel of the texture...but i would expect that the cut-offs would be cleaner then. Maybe you can try what happens if you shorten or lengthen the first segment(s)!?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Lines not drawing correctly for S2
« Reply #10 on: March 27, 2012, 09:14:18 pm »
Another question: Does it matter if the lines' color has an alpha==255|<255? Which alpha value are you using and does the results differ if you change it?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #11 on: March 27, 2012, 10:22:15 pm »
Quote
Another question: Does it matter if the lines' color has an alpha==255|<255? Which alpha value are you using and does the results differ if you change it?
I tried that the other day and seem to have no effect(my normal alpha is 200). Going to do some more testing now...

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #12 on: March 27, 2012, 10:47:16 pm »
Here are the lines higher in the y direction and looking from the side.

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Lines not drawing correctly for S2
« Reply #13 on: March 27, 2012, 10:53:55 pm »
Doesn't look like as if it would be directly related to the alpha channel...what happens if you move the transparent object (to the left for example...). Any changes in the lines then?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Lines not drawing correctly for S2
« Reply #14 on: March 27, 2012, 10:57:03 pm »
Here is a screen shot with only 1 grid square and I have scaled the wagon wheel lines by 3 (ignore the wrong position). Nothing has changed, however scaling the line did make it longer. I'm at lost what to test next.

[attachment deleted by admin]
« Last Edit: March 27, 2012, 10:59:56 pm by zammbi »