Jump to content
  • Advertisement
Sign in to follow this  
Lutz

Drawing texture in the background framebuffer

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

Hey, I'm trying to draw to a texture of size 1024x1024. I know it can be best done using pbuffers, but I want to use the framebuffer and glCopySubTexImage for now. So now, I'm - drawing the stuff - binding the texture - using glCopySubTexImage to copy parts of the frame buffer content to the texture. It all works fine, as long as the resolution of the frame buffer is greater than 1024 in x and y directions. However, if I use a lower resolution, e.g. 800x600, there are artifacts in my texture. I assumed that parts of the things I draw is just clipped since the current viewport is of size 800x600 and not 1024x1024. So I tried to increase the viewport with glViewport(0,0,1024,1024) right before I do the drawings, but it seemed to have no effect. Things still seem to be clipped away. Any clues? What do you do when the framebuffer (at least the current output screen) is smaller than the texture you want to render to? Without pbuffers, unless it's not possible at all!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Lutz
Any clues? What do you do when the framebuffer (at least the current output screen) is smaller than the texture you want to render to? Without pbuffers, unless it's not possible at all!


If you really want to do that, you'll have to render several times your scene, and copying using glCopyTexSubImage to fill part of your texture each time.

Even then, there is the pixel ownership test problem (Per-Fragment Operations paragraph in the gl spec). If your framebuffer is hidden by another window (even if you draw and read from the GL_BACK_BUFFER), the result of the copy is undefined for the region under the other window (but it can work for some opengl implementations).

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.

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!