I have to implement a 2D waterfall display that would work as follows.
Say our display is 500x500 pixels, when a new line of data arrives, it is draw at the very top of the display and all the previous data is copied one line down.
The easiest way I’ve come up with is to use glDrawPixels to draw the incoming data and glCopyPixels to copy the 499 topmost lines of data 1 down.
I have a couple of questions:
First, is this the best/most efficient way of doing this? (I may have up to 32 such displays going at once. And their size ranges from 100x100 to 1600x400 in any number of combinations limited only by the display resolution)
Second, as I have other symbols that need to be drawn on top of it but should not get copied down (ex a cursor), how do I ensure that glCopyPixels (or whatever better method one of you suggests ) only copies the data and not the symbology?
Any help, hints, links to examples, death threats, would be greatly appreciated.
- Create 500x500 texture
- update one line of texture
- Display textured quad on screen using this texture - each time use different texture coordinates - this way you can scroll the texture.
Of course at every step update next line of texture using glTexSubImage2D().
Visit nehe.gamedev.net for texturing tutorials.
Hello again folks,
seems to me that when I create a texture whose size isn’t a power of two, the program runs really slowly.
As an example, I took nehe’s lesson 8 and changed the bitmap sizes and reloaded the program. Although the program still runs with a 500x500 bitmap, the framerate drops to 1 frame per 30 seconds or something. If I resize to 1024x1024, then it runs smoothly.
Should I be setting something prior to using non power of two texture sizes?
It depends on your GPU. Does it support GL 2.0 and does it advertise ARB_texture_non_power_of_two?
If the extension is not present but GL version is 2.0, then you can make the texture with no mipmaps, no borders, GL_CLAMP_TO_EDGE
or alternatively use ARB_texture_rectangle
It’s important to detect features before using them else you may end up with software rendering (1 or 2 FPS)
I would suggest using power of two textures only.
You would use just a fraction of it’s width and entire height.
When updating you just go through the whole height of texture, but when diplaying you use only 500 pixels.
Thanks for the suggestions.
I’ve got something scrolling pretty smoothly now.
Now it’s just a matter of integrating it into the rest of my software to see how the performance holds up!
thanks again, much appreciated!