PDA

View Full Version : Displaying an image with OpenGL bigger than it actually is



toratora
24th May 2007, 19:33
Hi

I'm using glDrawPixels to display sequences of images (bitmaps). The pictures are 352x288, and I would like to have them displayed bigger, even if I lose quality. How can that be made?


Thanks!

wysota
24th May 2007, 20:22
Use the image as a texture for a quad. Then you can adjust the scale and OpenGL will handle the rest.

toratora
24th May 2007, 20:49
I'm not very experienced with OpenGL. Now I have the rgb data and that's what I use with glDraPixels. How can I do what you suggest?

Thanks!

wysota
24th May 2007, 21:08
Start here:
http://nehe.gamedev.net

toratora
31st May 2007, 17:54
Use the image as a texture for a quad. Then you can adjust the scale and OpenGL will handle the rest.

Hi again. I'm on my way of reading the tutorials. But before I go through it I'd like to make clear my purpose just in case.

What I'm doing now is displaying video from a webcam. It's a widget that includes a glDrawPixels method and, when called show in Qt, is displayed. Now, what I want is, on real time, being able to change the size (for instance, making the window bigger or smaller), and having the image do the same (that is, resizing and not chopping it when making it smaller or getting a black area when making it bigger). Let's say a Skype-like or just any average video player behaviour when you resize the window.

Is OpenGL the way to go, or is there's something on Qt that can make it?


Thanks!

high_flyer
31st May 2007, 21:24
generally doing this with OpenGL is not a bad idea.
It offers at least two advatages:
Its crossplatfom, its fast.
You also get the size of the image managment from openGL, and you have lots of freedom do do neat stuff when incorpreting in to an OpenGL based GUI.
I implemented (not with Qt) a video veiwer with openGL, but I used textures, istead of glDrawPixels.
Each frame is bound to a texture and then showed.
I guess that another implementation could be done with a fragment shader. (it could even be faster since it runs on the GPU.

wysota
31st May 2007, 22:03
I implemented a video viewer with OpenGL and Qt. I used textures as well...

toratora
27th June 2007, 09:34
Hi guys

I tried to do this after reading some tutorial but I can't just get it working

I just need some code that, when incorporated to a Qt Widget and called show, displays the picture (as I do now with glDrawPixels).

I've seen a lot of examples from OpenGL tutorials but don't know how to transfer that to Qt. I just need to create a quad (but don't get all the idea about the codenates; it will be just my widget, not inside of anything bigger) and creating the texture out of the pixels array.

Could you give me a hand? I cannot be very difficult, I just don't get it.


Thanks!