PDA

View Full Version : Waterfall display



freako
06-08-2007, 06:06 AM
Hello folks,

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 :D ) only copies the data and not the symbology?

Any help, hints, links to examples, death threats, would be greatly appreciated.

Thanks!

cheers

k_szczech
06-08-2007, 07:46 AM
Solution:
1. Create 500x500 texture
2. update one line of texture
3. 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.

freako
06-08-2007, 08:42 AM
Thanks!

I'll look into this!

cheers

freako
06-27-2007, 06:58 AM
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?

V-man
06-28-2007, 07:29 AM
It depends on your GPU. Does it support GL 2.0 and does it advertise ARB_texture_non_power_of_two?
http://www.opengl.org/registry/specs/ARB/texture_non_power_of_two.txt

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
http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt

It's important to detect features before using them else you may end up with software rendering (1 or 2 FPS)

k_szczech
06-28-2007, 10:12 AM
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.

freako
06-29-2007, 08:19 AM
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!