PDA

View Full Version : Display frame grabber acquisitions



sindri
02-19-2002, 06:24 AM
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.

NitroGL
02-19-2002, 06:33 AM
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).

kon
02-19-2002, 06:33 AM
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

kon
02-19-2002, 06:39 AM
Wow, message crash against nitro but still alive! http://www.opengl.org/discussion_boards/ubb/biggrin.gif

kon

sindri
02-19-2002, 06:56 AM
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... http://www.opengl.org/discussion_boards/ubb/confused.gif

kon
02-21-2002, 06:10 AM
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

jwatte
02-21-2002, 08:49 AM
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?

sindri
02-28-2002, 03:41 AM
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?

kon
02-28-2002, 04:15 AM
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

sindri
02-28-2002, 06:35 AM
I have a graphic card integrated on the mother board http://www.opengl.org/discussion_boards/ubb/frown.gif
I'm not using the frame grabber at the moment, i'm only copying a memory area!

kon
02-28-2002, 07:07 AM
So, probably that's the reason for this poor performance! Try to use a 'real' graphic card!

kon