Jump to content
  • Advertisement
Sign in to follow this  
hello_there

copying the frame buffer

This topic is 5136 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 want to copy the frame buffer into an array so i can do stuff to it. The size of my screen is 1024 by 768. I tried using glReadPixels() but it just went realy slow. Is there another way to do it. Can you somehow see what glCopyTexImage2D() copies. I'm trying to do dynamic gamma using sampled scene luminance from the book game programming gems 4. also one thing i don't get is how you adjust the scene. Can someone who's read the book or knows what i'm talking about explain to me or show me the code for the pixel shader to do it. [Edited by - hello_there on September 2, 2004 1:11:46 AM]

Share this post


Link to post
Share on other sites
Advertisement
you can use wgl_render_to_texture or glx_pbuffer extentions to copy the framebuffer to a texture, and use fragment shaders to manipulate them.

Share this post


Link to post
Share on other sites
I need to get the data in an array because i need to get luminance type data from it. I have a render to texture thing working. I tried using glReadPixels() on a downsized screen of 120 by 120 and it ran at 100 fps but that's a big drop down from 400 fps. So is there a faster way to do it?

Share this post


Link to post
Share on other sites
You can use glGetTexImage() to copy the contents of a texture into an array in memory,but generally it is best to avoid transfering data between RAM-VRAM,because it is slow.As I understand,you want to copy the frame buffer to an array,make some calculations there,and then copy the array back to the framebuffer.It will be much faster if you just render-to-texture,and then use a pixel shader to render the texture back to the framebuffer.You can put all your gamma calculations in the shader.

Share this post


Link to post
Share on other sites
This tutorial implements HDR lighting and uses a shader to blur the scene,by averaging neighbouring pixels.I think it's for DirectX,but it's very easy to figure things out.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can do 8 such samples on that card. You might have to do it in several passes between different pbuffers / rendertargets if you need more.

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!