Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Waterfall Display

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    2

    Waterfall Display

    Hello,

    Sorry I needed help in figuring out how to create a "waterfall display". It basically takes in a 2 dimensional array of 8bit pixels and displays it streaming down the screen. This data is just 8bit pixels and keeps streaming down my display (1600x1200).

    I've implemented this using QT but it the PaintEvent() which gets called to refresh the image each time is too slow in scrolling the data down the screen.

    I was wondering would the best solution be to generate a texture out of the 8bit pixels using opengl? Also, would I need to generate multiple textures of each line of data that comes in?

    Or can somebody please help me figure out what's the best solution?

    Thank you!!
    -James

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Waterfall Display

    You mean currently, you use glDrawPixels ? This is not really fast indeed.

    Not sure if using 1200 1D textures would be efficient.
    To me the best would be to split background in textured quads (for example size 256*256), reusing the 8*6 different textures : as soon as block is falls out of the view, glTexSubImage it with the next upper block.
    Ideally you should implement both ways and benchmark to find the best.

    About the repaint, I don't know Qt enough, is there something like the GLUT Idle Callback, to repaint screen continuously ?

  3. #3
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: Waterfall Display

    I'd use a single rectangular texture that is exactly as big as the screen.
    Each time you just update texture coordinates to scroll the image and update one or more rows (that got wrapped around in current frame) with new data using single glTexSubImage2D call.

  4. #4
    Advanced Member Frequent Contributor _NK47's Avatar
    Join Date
    Mar 2008
    Posts
    574

    Re: Waterfall Display

    a waterfall could be just a plane rendered with 2 triangles where seamless texture is applied to move the water in v direction with a texture matrix or shader. i believe this would not look cutting edge style.

  5. #5
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: Waterfall Display

    Well, he asked about "waterfall display" not "waterfall"
    Waterfall display is simply put a window that scrolls vertically above continous image (a stream of data).

  6. #6
    Advanced Member Frequent Contributor _NK47's Avatar
    Join Date
    Mar 2008
    Posts
    574

    Re: Waterfall Display

    ups. understand now. thanks for correction k_szczech. something new every day.

  7. #7
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    2

    Re: Waterfall Display

    Wow thanks guys for responding so quickly!

    k_szczech, that's what I was originally thinking about doing. I just wanted to make sure that this is the correct approach in opengl and that it's possible (b/c I'm completely new to opengl).

    ZbufferR, your approach is basically the same except I'm using blocks of textures right? (I don't really understand your comment about reusing the 8*6 different textures). Anyways, using this method, wouldn't I need to wait for (i.e.256) lines of data to come in before I can update the display?

    Thanks again for your replies. Now I just need to figure out how to create texture from the char buffer where the 8bit pixels are coming in.

  8. #8
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Waterfall Display

    indeed, k_szczech wrote the best solution

  9. #9
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    2

    Re: Waterfall Display

    I'm trying to do the same thing but I'm not clear about the suggested approach from k_szczech.

    Currently I am able to fill in the next row of data from my texture as new updates come in but I'm not actually scrolling the old data down the screen. Changing the texture coordinates doesn't really make sense to me.

    Can someone give a little more of a concrete example?

  10. #10
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: Waterfall Display

    to get your waterfall looking much nicer an easy method
    is to have 2 textures drawn blended over each other
    have them scroll down in the water direction but also have one slowly scroll left + the other slowly scrolling right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •