Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: How fast should this be (glDrawPixels)?

  1. #1
    Intern Newbie
    Join Date
    Nov 2000
    Posts
    36

    How fast should this be (glDrawPixels)?

    Okay, I know all about the speed issues with glDrawPixels() but I'm hoping to be able to use this with acceptable results. I have an application that I need to be able to read, modify & draw some pixel data. I know that OpenGL isn't the fastest at doing this, but I'm using OpenGL for all of my 3D stuff as well.

    So here is the worst case scenario, given a 450MHz Pentium II running the MS "Software" driver, how long would you expect it to take to draw a 675x500 image using glDrawPixels()?

    On this particular system that I am testing, it is taking 6 seconds to draw this image, which seems too long. I'm pretty sure I've got all the stuff turned off that slows down glDrawPixels(), but I'm starting to wonder.

    Thanks in advance for your help.
    -Keith

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: How fast should this be (glDrawPixels)?

    I'm not sure about the the software implementation but the PRIMARY thing to do when using glDrawPixels on consumer cards is to make sure that your source format matches the frame buffer format. The implementation will do the conversion but usually this is really slow.

    Eg if you requested a 32 bit RGBA color buffer, you should also submit 32bit RGBA data to OpenGL.

    For example on a recent Radeon ICD, writing 640x480 16bit pixels to a RGBA_8888 frame buffer takes 120ms on my machine. Doing the conversion myself and writing RGBA_8888 reduces this to 15ms

  3. #3
    Intern Newbie
    Join Date
    Nov 2000
    Posts
    36

    Re: How fast should this be (glDrawPixels)?

    So in this case, you set the data type to GL_UNSIGNED_BYTE to maximize the performance -- correct?

    I thought in general the GL_UNSIGNED_BYTE was the fastest data type for reading & writing pixel data.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: How fast should this be (glDrawPixels)?

    "So in this case, you set the data type to GL_UNSIGNED_BYTE to maximize the performance -- correct?"

    Almost

    something like glDrawPixels(....,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8) ;
    <- note that this might require _EXT suffixes on pre 1.3 headers (EXT_packed_pixels got integrated into 1.3).

    "I thought in general the GL_UNSIGNED_BYTE was the fastest data type for reading & writing pixel data."

    Not necessarily. If you end up with a 16bit color buffer, you are generally better off writing with
    glDrawPixels(....,GL_RGB,GL_UNSIGNED_SHORT_5_6_5);

    You can check your color buffer bit depth with DescribePixelFormat().

  5. #5
    Intern Newbie
    Join Date
    Nov 2000
    Posts
    36

    Re: How fast should this be (glDrawPixels)?

    Thanks for the follow up. I also knew about the format for 16bit color buffers, but I thought I read that someone changed from the GL_UNSIGNED_INT_8_8_8_8 to GL_UNSIGNED_BYTE and got better performance on their system.

    The GL_UNSIGNED_INT_8_8_8_8 format is new to me, what is the advantage of this format?

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: How fast should this be (glDrawPixels)?

    "The GL_UNSIGNED_INT_8_8_8_8 format is new to me, what is the advantage of this format?"

    I don't know, it just sounded flashy

    In all seriousness, I don't know if that one or GL_UNSIGNED_BYTE is faster. I haven't benched these two against another yet. AFAIK they should both do exactly the same thing for me, because I use destination alpha.

    If you have a simple RGB buffer, GL_UNSIGNED_BYTE will probably be faster because the driver doesn't have to throw away the alpha channel and pack.

    If you want to read more on _8_8_8_8 and similar stuff I suggest you have a look at the EXT_packed_pixels spec or the GL1.3 spec on document page (!= acrobat reader page) 98+.

  7. #7
    Intern Newbie
    Join Date
    Nov 2000
    Posts
    36

    Re: How fast should this be (glDrawPixels)?

    Thanks zeckensack for the help.

    Now, back to my original question -- can anyone confirm my time for drawing a pixel image as listed in the frist message?

  8. #8
    Intern Contributor
    Join Date
    Dec 2000
    Location
    Halifax, Nova Scotia, Canada
    Posts
    90

    Re: How fast should this be (glDrawPixels)?

    Check out my recent thread testing a very similar application. The top speed we were able to get was 8-9 fps, or 120ish milliseconds. http://www.opengl.org/discussion_boa...ML/005569.html
    I've been told that much better is possible, but I haven't seen it.
    Joe

  9. #9
    Intern Newbie
    Join Date
    Nov 2000
    Posts
    36

    Re: How fast should this be (glDrawPixels)?

    JoeMac -- thanks for the notification. I've been following your thread as well -- but there have been some new posts since I last read it.

Posting Permissions

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