View Full Version : Drawing image as background
08-12-2003, 02:14 AM
I have a camera with a live video that I want to display as background in my OpenGL application. The image format is either on array-form, or on National Instrument's IMAQ Image format.
How can I draw the frames from the camera in the most effective way? I want as many frames per second as possible.
(I also want to be able to draw OpenGL graphics on top of the video image).
I appreciate any suggestions and/or sourcecode/examples :-)
08-12-2003, 02:40 AM
Hmmm... That sounds interesting. As you can guess there is plenty of ways to do that (as always http://www.opengl.org/discussion_boards/ubb/wink.gif ). I suppose that using pixel-transfer commands (like glDrawPixels) won't be sufficent for a live, real-time camera recording (unless you want to have a film in a size 100x100 pixles).
Meaby there are some "trickier" solutions but using some texture mapping could be usefull in this case. It would be much easier to add some effects to the background (some filters, blur, disortion, color blending etc...). Also you woludn't have to bother about depth testing since you can always draw your background as a texured quad behind all the objects. The question is whether creating textures reapeatedly will be too much for a GPU or not.
I'll think about that.
08-12-2003, 03:51 AM
If you are going to be going 3D object in the fore ground then you will need to do the video on as a texture on a quad in the background. I think copy pixels would slow down the operation too, vs. rendering the video to a texture which would be handle more in hardware. also would allow some nice video effects if done as a texture.
08-12-2003, 05:05 AM
We run in to this problem frequently with our embedded graphics clients. There is, unfortunately, no really fast application-level solution. We wound up adding a custom API to OpenGL for this, similar to the DirectX mechanism.
The fastest application-level mechanism will probably be to render the data directly to a pre-bound texture like in this NeHe example: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=29.
If you are looking to do this on an embedded system long-term, contact me and we can talk about our embedded OpenGL driver.
08-12-2003, 09:23 PM
I guess I will give textures a try, then, and follow Nehe's tutorial 29.
This next question must be "swearing" in an OpenGL forum, but: would it be easier to code the same thing in Direct3D? Is Direct3D more high-level, or is it just about the same (in this specific example)?
(Hope I haven't hurt anyones feelings ;-)
08-13-2003, 03:33 AM
You hurt me http://www.opengl.org/discussion_boards/ubb/wink.gif
08-13-2003, 03:35 AM
I can't tell you if DirectX is better choice for this particular application because I just don't know it.
I believe that checking out OpenML can be usefull.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.