View Full Version : Problem starting to bug me

07-24-2003, 12:32 AM
hum, I know I already ask but i can't live with this;
has anyone heard of a problem similar to what's on the picture :

this is a scene i've done in opengl, and I had the same in GTA3 and GTA Vice City...

I dont think there is anything to see with z-fighting, cause i tried to improve it with glPolygonOffset, and I event tried to make the light map not touching at all the textured wall (there is 1 opengl distance unit between the two). Moreover, the white dot lines mov when i move the camera...

so if anybody has an idea, please tell me


07-24-2003, 12:38 AM
what's your zbuffer depth?
what's your znear/zfar planes setting?

Tell us more

07-24-2003, 12:49 AM
alright i'm kind of a beginner so my answer may not be satisfying http://www.opengl.org/discussion_boards/ubb/frown.gif

I used glut so i didn't manually set any depth buffer. I got this :
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); which enable the depth buffer but i don't know its depth....

for the znear/zfar, i have : 0.1 and 10000.... cause the first thing i did was a space simulator so I had to see really far

how can i tel you more about my depth buffer ?


07-24-2003, 12:54 AM
Try to move your near plane to a higher value, and do you have 16 or 32 bit mode on the desktop? if you have 16bit then your zbuffer often will become 16bit, that might be to small resolution for that settings ( depending on how far away the wall is).

07-24-2003, 12:58 AM
in fact a bit of code is maybe the best way to show you what i want to do :

DrawFace(-8, 0, -30, 60, 30, 'x', 1, true, 0, false); // mur gauche
DrawFace(-8, 0, -30, 16, 60, 'y', 5, true, 18, false); // Sol

/////////// Decals
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // transparency

DrawFace(+8, 3, -7, 3, 3, 'x', 19, false, 0, false);


////////////////////// LightMap
// Transparancy

glPolygonOffset(4, 4);

glColor3ub(0, 25, 50);
DrawFace(8, 2.5, 5, 5, 5, 'x', 18, false, 0, false); // Reflet de la carte
glColor3ub(255, 255, 255);



DrawFace(-8.0, 0, -30, 60, 30, 'x', 18, false, 0, false); // Mur gauche


so thats : a brick wall, a decal and i'd wish a light map lighting the wall and the decal....

mazy :
i have a 32 bit resolution for my desktop, and the whole scene is in a volume not bigger than -30, +30 on x and z axis. for the near plan, i'm gonna try, thx


07-24-2003, 01:08 AM
hum, so i have put the near plan to 1, and i added polygon offset before the decal, and a bigger one before the light map, and now the white dot line are located on the decals, that i dont see anymore (except the dot line)

but they still move when i move the camera which is ...... weird