Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Quad appearing infront of other Quads problem

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Astra   Members   

100
Like
0Likes
Like

Posted 10 July 2011 - 07:26 AM

Hi guys, I'm writing a 3d game, and my characters (two brown rectangles at the moment) are showing up in front of all other objects. Their Z value is 8.85, and the front and back values of the stage are 8.7 and 9.0. So i would assume my characters would go ''through'' the stage when i move them down or up, but they appear in front as though they are closest to the screen.

Here are my files I'd appreciate any input:


main.cpp
http://pastebin.com/TLnLF5Le

main.h
http://pastebin.com/UPheJgAa

keyboard.cpp
http://pastebin.com/ntJ2AF62

keyboard.h
http://pastebin.com/U0B0Vwnt

character.cpp
http://pastebin.com/2fjQWYXp

character.h
http://pastebin.com/QmXwKiug


thank you

#2 EVIL_ENT   Members   

276
Like
1Likes
Like

Posted 10 July 2011 - 08:07 AM

I couldn't find any setup for your depth buffer.
http://www.opengl.or...depthbuffer.htm
If you don't have any depth testing opengl will display what you have drawn last on top of everything.
Same what happens when drawing in real world.

You could also sort your objects yourself so you begin drawing with the objects which are far away.
But if you have objects which are intersecting each other that won't work.

#3 Astra   Members   

100
Like
0Likes
Like

Posted 10 July 2011 - 10:23 AM

I couldn't find any setup for your depth buffer.
http://www.opengl.or...depthbuffer.htm
If you don't have any depth testing opengl will display what you have drawn last on top of everything.
Same what happens when drawing in real world.

You could also sort your objects yourself so you begin drawing with the objects which are far away.
But if you have objects which are intersecting each other that won't work.


thanks mate, was just missing the glEnable(GL_DEPTH_TEST) command




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.