Skip to main content
gamedev.net
🔒 Locked

GL_DEPTH_COMPONENT Question

Started by MARS_999 1 reply 1k views
Original Post
MARS_999
MARS_999
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.
Optus
Optus
I'm pretty sure you'd only want to copy the depth component to a depth texture, not an RGB.
Master Tonberry
Master Tonberry
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 );
_____My open source shadow engine:http://www.mikaellagre.com/theroom/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.