Lines not drawing correctly for S2

Started by zammbi, March 26, 2012, 04:29:17 AM

Previous topic - Next topic

zammbi

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:
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:

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.

EgonOlsen

I don't get this part:

Quoteif 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?

zammbi

If I change the code like so:

//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
plane.setTransparency(5);


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

EgonOlsen


zammbi

Here is the screen shot(below) without the grid, showing both wagon wheel lines and pitch map lines.

[attachment deleted by admin]

zammbi

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]

zammbi

#6
Here is the screen shot(below) with no texture and transparency. The lines start working again...

[attachment deleted by admin]

EgonOlsen

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...

zammbi

QuoteReally strange. Just to be sure: If you keep transparency but don't set the texture, the lines show up too?
They don't show.

QuoteCould 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.

EgonOlsen

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)!?

EgonOlsen

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?

zammbi

QuoteAnother 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...

zammbi

Here are the lines higher in the y direction and looking from the side.

[attachment deleted by admin]

EgonOlsen

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?

zammbi

#14
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]