Jump to content
  • Advertisement
Sign in to follow this  
Kynes

OpenGL Shadow mapping and viewport size

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

Hello everyone, I am trying to implement shadow mapping, using OpenGL and GLUT. To sum up, I proceed as follows: 1) glViewport (size of the shadow map) 2) draw geometry from the light point of view 3) copy depth component to texture 4) glViewport (size of the window) 5) render the scene, and do depth comparisons To make a copy of the depth buffer, I use the glCopyTexImage2D function. Everything works fine, as long as the shadow map is smaller than the window. But if I use a 1024x1024 shadow map and a 800x600 glut window, the only data copied to the texture is in the lower-left 800x600 rectangle (that could have actually been displayed on screen...) I wonder if this is this a behaviour that one should expect (meaning I can't render "outside" the glut window, and that I should render to a pbuffer for instance), or if there is a bug somewhere in my code... any idea ?

Share this post


Link to post
Share on other sites
Advertisement
You should use a Frame Buffer Object instead copying the backbuffer to a texture. With a FBO you can render directly into the depth texture and the view port isn't limited to the windows size anymore.

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!