Jump to content
  • Advertisement
Sign in to follow this  
aresio

Issue with depth test

This topic is 3688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a scene composed of opaque and translucent objects. I need to recognize what parts of translucent objects are visible from camera's pov, discarding the rest. I tried to do so: 1) empty color and depth buffer 2) render just the depths of opaque geometries 3) keep the just filled depth buffer and render the colors of translucent geometries I thought that doing this would fill my color buffer with just the "visible" (= GL_LESSer) fragments of translucent objects. but it does not, the depth test doesn't seem to work and I obtain a render of all translucent objects. I do post my snippet... can you help me out please? :)
//1
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

//2
		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
		glCullFace(GL_BACK);
		glShadeModel(GL_FLAT);
		glDisable(GL_LIGHTING);
		glDrawBuffer(GL_NONE);		// I'm using FBOs!

		RenderFunc(GVREND_OPAQUE);

//3
		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);						
		glShadeModel(GL_SMOOTH);
		glEnable(GL_LIGHTING);		
		glDrawBuffer(GL_COLOR_ATTACHMENT0);
			
		RenderFunc(GVREND_TRANSP);


Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!