Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

GL_DEPTH_COMPONENT Question

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

With GL_DEPTH_COMPONENT being used with this function. glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, WATER_TEXTURE_SIZE, WATER_TEXTURE_SIZE, 0); I have a rgb texture setup and was wondering should I be using a 8bit greyscale texture instead? Or will GL just map the same value to all three channels or just Red channel? I am not sure how this works. Thanks for any help in clearing this up.

Share this post


Link to post
Share on other sites
Advertisement
I'm pretty sure you'd only want to copy the depth component to a depth texture, not an RGB.

Share this post


Link to post
Share on other sites
Yes the internal format should be GL_DEPTH_COMPONENT but the external format can also be a GL_DEPTH_COMPONENT (for example a 24 bit depth component).

This is how I do to create shadow maps:
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_size, m_size,
0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL );

Share this post


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

  • 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!