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 2 12 LastLast
Results 1 to 10 of 11

Thread: Display frame grabber acquisitions

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    11

    Display frame grabber acquisitions

    I have to display the acquisitions captured by a frame grabber at 25 frame/second with a resolution of 768x576 pixels.
    I know that it is preferable to use texture instead of glDrawPixel, i try to use it but it doesn't seem to be better.
    Perhaps i'm getting wrong something...

    Thanks

    S.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    May 2001
    Location
    Beloit, Wisconsin
    Posts
    562

    Re: Display frame grabber acquisitions

    Originally posted by sindri:
    I have to display the acquisitions captured by a frame grabber at 25 frame/second with a resolution of 768x576 pixels.
    I know that it is preferable to use texture instead of glDrawPixel, i try to use it but it doesn't seem to be better.
    Perhaps i'm getting wrong something...

    Thanks

    S.
    OpenGL requires you to use a power of 2 texture (ie. 512x512, 512x256, 256x256, 256x128, etc). You could use the GL_NV_texture_rectangle (*gag*) extension, but that would be nVidia only.

    If your framegrabber can use custom width and height, I would try to use a power of 2 width and height on it (like 512x512 or 512x256).

  3. #3
    Junior Member Regular Contributor
    Join Date
    Aug 2001
    Posts
    204

    Re: Display frame grabber acquisitions

    Do you define a texture object during initialization (with glTexImage2D(....,0) and dimensions next higher to the power of 2 of the grabbed image's dimension 1024x1024 in your case) and in your display function after getting the actual image updating the texture using glTexSubImage2D(...)?

    kon

  4. #4
    Junior Member Regular Contributor
    Join Date
    Aug 2001
    Posts
    204

    Re: Display frame grabber acquisitions

    Wow, message crash against nitro but still alive!

    kon

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    11

    Re: Display frame grabber acquisitions

    In my display function i wrote:
    ...
    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 768, 576, GL_LUMINANCE, GL_UNSIGNED_BYTE, pImage);
    glEnable(GL_TEXTURE_2D);
    glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex2f( 0, 0);
    glTexCoord2f(0, 576/1024); glVertex2f( 0, 576);
    glTexCoord2f(768/1024, 576/1024); glVertex2f(768, 576);
    glTexCoord2f(768/1024, 0); glVertex2f(768, 0);
    glEnd();
    ...

    Is that all right?
    It takes about 250 msec on a 933MHz Pentium III... amazing!
    I'm crying for it...

  6. #6
    Junior Member Regular Contributor
    Join Date
    Aug 2001
    Posts
    204

    Re: Display frame grabber acquisitions

    Try to comment out the glTexSubImage2D(...) call and time your app. How long does it take to render the quad now?
    Just to find out if the glTexSubImage2D call is the one taking so long!

    kon

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,704

    Re: Display frame grabber acquisitions

    Timing individual calls is mis-leading, as the call may copy the data to some other system memory and then return, and upload the image in the background. At a minimum, use glFinish() when you want to time things.

    Are you sure that the initial glTexImage specifies the same internal pixel format (GL_LUMINANCE) that you're using in TexSubImage? Else it'll have to convert, which would be slow.

    Are you sure that AGP is working on your machine?

    Are you sure that your hardware accelerates GL_LUMINANCE? Is it faster if you upload a GL_BGRA image instead?
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  8. #8
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    11

    Re: Display frame grabber acquisitions

    The pixel format type is the same in the two functions. I tryed with the GL_RGBA but it the same thing!
    Is it only a graphic card problem?
    I don't know how check if AGP is working well...
    Sholud i change my graphic card?

  9. #9
    Junior Member Regular Contributor
    Join Date
    Aug 2001
    Posts
    204

    Re: Display frame grabber acquisitions

    What kind of graphic card do you use? Are you sure your app uses HW OpenGL? Try to not call your frame grabber to get the pictures but just put some random pixels into your glTexSubImage call and see what happens with the framerate.

    kon

  10. #10
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    11

    Re: Display frame grabber acquisitions

    I have a graphic card integrated on the mother board
    I'm not using the frame grabber at the moment, i'm only copying a memory area!

Posting Permissions

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