PDA

View Full Version : Scale the Contents of pixelBuffer



Seagate123
01-18-2010, 02:12 AM
Hi,
I m newbie to OpenGl.I have 1024*768 image in pixel buffer.
But i need a 352*288 image in same pixel buffer.
How can I do it?
I have gone through the topics but couldn't find an answer.
If the question is repeated kindly excuse me. :)

aqnuep
01-18-2010, 04:14 PM
You can upload the data stored in the pixel buffer into a texture using glTexImage2D and render a quad which resizes the image to the needed size in pixel (this needs the correct adjustment of the modelview matrix).
After this you should read back the content of the framebuffer to the pixel buffer using glReadPixels.

Seagate123
01-18-2010, 09:45 PM
Thanks for reply.
But my problem is not solved.I tried like this.

glTexImage2d(GL_TEXTURE_2D,0,GL_BGRA,1152,864,0,GL _BGRA,GL_UNSIGNED_BYTE,baseaddofpixelBuf);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glScalef(3.3,3,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

After this i used glReadPixels to read data into pixelBuf and found image is still in 1152*864.

Any help is appreciated.
Thanks in advance