PDA

View Full Version : Depth buffer problem



egydev
05-18-2010, 09:37 PM
HI ALL
PLEASE I DRAWN A SIMPLE CBE USING SEX QUADS PRIMITIVES WITH THE NORMAL KNOWN COMMAND GLBEGIN(GL_QUADS)

OK WHEN I ROTATE WITH MY FIRST PERSON CAMERA AROUND THE CUBE
WHEN LOOKING TO IT FROM THE REVERSE SIDE SO THE BACK OF THE CUBE APPEAR INFRONT OF THE FRONT SIDE :D YOU KNOW IN THE ORIGINAL LOOK AT DIRECTION FRONT SIDE APPEARS INFRONT OF BACK SIDE
BUT WHEN I CHANGE CAMERA POSITION BACK SIDE IS IN FRONT OF FRONT SIDES
DETP BUFFER TEST IS ENABLED
I THINK I UNDERSTAND THE REASON IS THAT IN CODE I DRAW FACE OF THE CUBE BEFORE ANOTHER FACE SO WHAT EVER WAS THE DIPOSITION OF THE CAMERA THE FIRST DRAWN FACE WILL BE DRAWED TO SCREEN FIRST



PLEASE I REALY WANT TO FIND A SOLUTION BECAUSE IAM BUILDING A CITY OF PRIMITIVES AND WITH THIS WAY BUILDINGS GO INSIDE EACH OTHER AS I LOOK TO THEM FROM DIFFRENT SIDES
THANKS IN ADVANCE

mhagain
05-19-2010, 02:47 AM
glEnable (GL_DEPTH_TEST);

egydev
05-19-2010, 03:53 AM
glEnable (GL_DEPTH_TEST);



thank you so much but depth buffer test is enabled and the problem is still running

Ludde
05-19-2010, 04:52 AM
Maybe glFrontFace and/or glCullFace

mhagain
05-19-2010, 06:26 AM
What about depth writing then? glDepthMask (GL_TRUE)?