Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Using glDrawPixels and GL_DEPTH_COMPONENT

This topic is 6270 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

I want to load a photographic background and depth information into the Color Buffer and the Depth Buffer however I seem to be having a problem with the depth buffer so I just tried the easiest thing I could test. int size = pDepth->GetWidth() * pDepth->GetHeight(); float* zBuffer = new float[size]; for( int i=0; i zBuffer = 0.0f; // At The beginning glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); { glDrawPixels( pDepth->GetWidth(), pDepth->GetHeight(), GL_DEPTH_COMPONENT, GL_FLOAT, zBuffer ); } glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); delete[] zBuffer; glFlush(); Now when I draw an object with glDepthFunc( GL_LESS ); I shouldn''t see any objects, right ? Well I do, so can anyone help me out in finding a simple sample that does something similar. Oh, as these are "slow" commands. I have assumed that when I come to optimizing I can use glCopyPixels to blt between video memory requiring no conversion and no transfer over bus. Therefore being quick as the background and the depth info doesn''t change. Is this correct also? Thanks.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!