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.

Originally posted by sindri:
[b]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.[/b]

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).

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

Wow, message crash against nitro but still alive!

kon

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…

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

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?

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?

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

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!

So, probably that’s the reason for this poor performance! Try to use a ‘real’ graphic card!

kon