Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Z-Buffer Issues


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 jonseager   Members   -  Reputation: 112

Like
0Likes
Like

Posted 23 December 2012 - 09:41 AM

Hi

I'm developing a very basic 3D world type application but I'm having trouble with my z-buffer. Essentially, I load models from Obj files and each separate model has its own model matrix - I then multiply this by the view/projection matrix as each one is rendered.

Each model has its own VAO/VBO and then in the main loop I just call `model1.render()` then `model2.render()` etc. The render method loads the relevent VAO/VBO and then calls drawArrays(). Problem is, the z-buffer appears to be doing nothing. So if I have cube at (0,0) and a sphere at (0,10) - all the time that the cube render call is after the sphere render call, the cube is rendered in front of the sphere.

I can't figure out what the issue is at all? Is it because I use the separate VAOs/VBOs?

Many thanks

Jon

Edited by jonseager, 23 December 2012 - 09:42 AM.


Sponsor:

#2 santa01   Members   -  Reputation: 307

Like
0Likes
Like

Posted 23 December 2012 - 11:13 AM

do you have depth-test enabled? glEnable(GL_DEPTH_TEST);



#3 jonseager   Members   -  Reputation: 112

Like
1Likes
Like

Posted 23 December 2012 - 11:14 AM

Hi

 

I actually just fixed it - I had all the depth test options set but hadn't specified 24 bit z-buffer when opening the GLFW window.

 

Thanks

 

Jon






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.



PARTNERS