PDA

View Full Version : bird flying between mountain



openglfan
07-09-2012, 10:32 AM
hello
i am writing a game
i wrote a scene (3 wall with texture of sky ,1 wall with texture of grass, 2 mountain with glutSolidCone )
and a bird is flying in the scene,
----------------------------------------
but in the display() if i write :

//draw scene
//birdflying()

bird flies in front of mountain

but if i write:

//birdflying()
//draw scene

bird flies behind of mountain

-------------------------------------------
but i want that bird flies behind and in front of mountain and ofcourse between them,what's wrong? what should i do?

thanks in advance :)

aqnuep
07-09-2012, 11:15 AM
You probably didn't enable depth test or you don't have a depth buffer.

openglfan
07-09-2012, 11:54 AM
You probably didn't enable depth test or you don't have a depth buffer.

yes i forgot it
but when i write glEnable(GL_DEPTH_TEST); in the init and run my program ,it shows nothing just black window. now what should i do?