Jump to content
  • Advertisement
Sign in to follow this  
Lode

OpenGL Screenshot

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

Is it possible to get a shot of the current screen and store it in a buffer or texture, and then redraw this screen by using this screenshot? Actually what I want is this: first there's all sorts of 3D things being drawn, but then the 3D scene drawing pauses and a translucent window appears in which you have to enter some text. It's impossible to draw the 3D scene behind the window over and over again, because the 3D scene is generated by something very special (a sort of interpreter) that isn't working while the translucent window is waiting for input. But it would be possible to redraw the 3D scene behind the window if I could take a screenshot of the 3D scene and redraw this screenshot behind the translucent window all the time. How can I do this with OpenGL?

Share this post


Link to post
Share on other sites
Advertisement
You can use glReadPixels() to get grab the screen buffer glDrawPixels() to place it back on the screen before rendering your window. Though it might be faster to bind the result of glReadPixels() to a texture and render it with a quad rather than to use glDrawPixels().

Share this post


Link to post
Share on other sites
Hm, glCopyTexImage2D() or glCopyTexSubImage2D() will be much faster though, since they don't include transfer of data between the card and RAM.

Share this post


Link to post
Share on other sites
I assume what's in the translucent window will change right. If nothing is erased, only added to the scene, you don't have to clear the screen, rather just render over, blending the window. Since you never clear the screen, the background never needs to be rerendered. This only applies if what you are rendering always adds to what is there pixel-wise. A rotating triangle wouldn't work, but text, even text input would, unless you can hit backspace. It's not much of a solution, but in certain cases it works. Otherwise, the quickest way is to glCopyTexSubImage2D(), I think the function is called, unless you know the user has (FBO) or(PBuffer) extensions on his card.

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!