Hello,
I am trying to scaledown a texture using FBO with but i only end cropping it instead of resizing it
What can possibly go wrong? I tried setting viewport & projection matrix but setting it only hides the image. Please guide me through this process and suggest a proper way of scaling down images using OpenGL.
FBOTexture fbo = [self setupFBO:NSMakeSize(texWidth, texHeight) buffer:CVPixelBufferGetBaseAddress(frame)];
CVPixelBufferUnlockBaseAddress(frame, 0);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo.fbo);
//glViewport(0, 0, scaledWidth ,scaledHeight);
//glMatrixMode(GL_MODELVIEW);
//glLoadIdentity();
//glMatrixMode(GL_PROJECTION);
//glLoadIdentity();
//glOrtho(0, scaledWidth, 0, scaledHeight, -1.0, 1.0);
glBegin(GL_QUADS);
glTexCoord2i(0, 0); glVertex2i(0, 0);
glTexCoord2i(0, texHeight); glVertex2i(0, scaledHeight);
glTexCoord2i(texWidth, texHeight); glVertex2i(scaledWidth, scaledHeight);
glTexCoord2i(texWidth, 0); glVertex2i(scaledWidth, 0);
glEnd();
//[glContext flushBuffer];
CVPixelBufferLockBaseAddress(resizedFrame, 0);
glReadPixels(0, 0, scaledWidth, scaledHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, CVPixelBufferGetBaseAddress(resizedFrame));
CVPixelBufferUnlockBaseAddress(resizedFrame, 0);



NSSize)size buffer