Hello All,
In my application , I need to do brightness related operation on the image. I done with following things
- Getting image from photo library.
- Drawing that image using the Open GL.
Changing the brightness of the image.
-(void) DoBrightness:(float) aBrightness { [EAGLContext setCurrentContext:context];
}// Clear the buffer glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); glClearColor(0.0, 0.0, 0.0, 0.0); glActiveTexture(GL_TEXTURE0); glVertexPointer(2, GL_FLOAT, 0, spriteVertices); glEnableClientState(GL_VERTEX_ARRAY); glTexCoordPointer(2, GL_SHORT, 0, spriteTexcoords); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); if (aBrightness >= 1.0f) { glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD); glColor4f(aBrightness-1, aBrightness-1, aBrightness-1, aBrightness-1); } else { glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_SUBTRACT); glColor4f(1-aBrightness, 1-aBrightness, 1-aBrightness, 1-aBrightness); } glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // Display the buffer glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); [context presentRenderbuffer:GL_RENDERBUFFER_OES];
Problem comes when I try to save image with brightness. Actually it is saving previous image i.e image w/o brightness
can any one help me , how to save image using rendered buffer?
thanks,
Sagar