PDA

View Full Version : 2D Rendering & View Movement



mcindafizzy
01-20-2011, 01:10 PM
Greetings,

I am drawing simple shapes in 2D with an orthographic projection. What I want to be able to do is slide what I'm drawing from right to left. I'm working on a very simple audio visualizer and I want to draw a square for the current frequency on the right side of the screen, then each render frame I want everything that has been drawn to move X units (preferably OpenGL units and not pixel units) to the left.

First I'm wondering what method is suggested for accomplishing this. It seems to me that there are two main ways to tackle the problem:

1. Translate the MODELVIEW projection each render frame, or

2. Draw to a buffer and move all the pixels in the buffer 1 pixel to the left each frame

I've tried #1 and I seem to be unable to actually get the camera to move...the elements drawn to the screen just stay in place.....each render cycle I do not clear the color buffer, and I do not reset the projection to the identity, so I figured that I should see the output buffer moving from right to left each frame by way of the glTranslate() function for the MODELVIEW matrix.

#2 I have not tried because I'm not sure what kind of buffer to use, nor do I know how to create/manage buffers...

Any help?

Thanks.