Can I output my buffer to the screen faster?

I want to make an animation using my ray tracer. In order to speed up my ray traced scene, I store each pixel in a float array(RGB). When all of the frames have been stored, I write them out to the screen one pixel at a time with GLColor3f(…)and then call SwapBuffers() (since I’m using double buffering) at the end of each frame rendering.
Is there a faster way to push the array into GLColor? Does anyone have a better way to do this?

Hello

Upload your frames as textures instead, and then just display the textures one after another when you’re done. This should be much faster.

Osku

Yes, first convert that to a normal unsigned byte image, this alone will make for an improvement. Second, try using glDrawPixels with the entire image on an orthographic viewport. The other option is to create trianglar mesh that uses the image as a texture and you just update the texture and rerender the mesh for the next frame.

I don’t use any of these methods, I have instead choose to either use X in linux or DirectDraw in windows, but these should help for sure.

Neil Witcomb

Originally posted by witcomb:
[b]Yes, first convert that to a normal unsigned byte image, this alone will make for an improvement. Second, try using glDrawPixels with the entire image on an orthographic viewport. The other option is to create trianglar mesh that uses the image as a texture and you just update the texture and rerender the mesh for the next frame.

I don’t use any of these methods, I have instead choose to either use X in linux or DirectDraw in windows, but these should help for sure.

Neil Witcomb[/b]

Thanks. I used glDrawPixels and my scenes are drawing faster than I had even hoped.

  • Kwan