Jump to content
  • Advertisement
Sign in to follow this  
necrophilissimo

How to grab the frambuffer for drawing?

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

I ran into this interesting subject on my other post, so I decided to ask how is it actually done : How do I grab the frambuffer so I can place it on a grid/other polygonal object and create water warp / shockwave effects? glCopyTexImage2D doesn't seem to be an option, as it has VERY limited texture sizes (can't grap 800x600 screen, for instance) and it's quite slow. I know right way would be using pixel shaders, but as most older cards (for which my small game is targeted) doesn't support them, I decided not to use it.

Share this post


Link to post
Share on other sites
Advertisement
I'm no expert at OpenGL, or graphics rendering at all, but I do recall reading somewhere that if you wanted to do filters and/or effects (which is what it sounds like you're looking to do), you can set the render target to be an offscreen texture that is the size of your backbuffer/framebuffer, and render your scene to that. Once you're finished doing the scene, set your render target back to your backbuffer/framebuffer and render that texture out as a quad.

That's just what I read, but hopefully it should give you an idea or two.

EDIT: I forgot to add that before you render the final texture to the quad, you could enable the shaders to apply your effects to it. That way, it will be affecting the entire view the player has, as opposed to trying to sort out the separate objects in your scene. Again, I could be completely wrong about this, as I've never worked with shaders before.

Share this post


Link to post
Share on other sites
Waiting other experts I can tell you that one solution can be render the scene to a frame buffer that is a sort of "offscreen surface" (windows independent) then use the frame buffer as the texture source (when you will render to the color buffer).
I read some tutorial/specification and it's not difficult to set up but I never used it.

However the frame buffer is an extension too! And I dont know what is its support for older cards.

The water warp effect can be also achieved with a mixing of mesh warp and texture scale/rotation/translation; I remember that a long time ago I played with this method with interesting results!



Share this post


Link to post
Share on other sites
You have several options:

1) Use PBuffers to create an off-screen rendering surface, these are platorm specific. I would avoid this option.

2) Use EXT_Framebuffer_object. This is the way of the future, but is not widely supported yet. Existing implementations are also likely to be buggy.

3) Use ARB_texture_rectangle. This will allow you to use glCopyTexImage with non-power of two textures. This is probably the approach that is most cross-platform, and most compatable with older hardware. It should also perform reasonably well.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!