Sign in to follow this  
hello_there

copying the frame buffer

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this