Hi,
I get every frame from function ViewFinderFrameReady in symbian os. i want to render the
frame as backgroud. So i used these codes:
TBitmapUtil* pBmpUtil=new (ELeave)TBitmapUtil(iBitmap);
pBmpUtil->Begin(TPoint(0,0));
TUint8* aCamFrameData=(TUint8*)iBitmap->DataAddress();
pBmpUtil->End();
delete pBmpUtil;
// Textures are initialized in OpenGL ES API by this function.
glGenTextures( 1, iTexturesID );
//Bind the background texture to iTexturesID[0], set the texture environment.
glBindTexture( GL_TEXTURE_2D, iTexturesID[0] );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 256,
0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)aCamFrameData );
glViewport( 0, 0, size.iWidth, size.iHeight);
// Recalculate the view frustrum
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
GLfloat aspectRatio = (GLfloat)(size.iWidth) / (GLfloat)(size.iHeight);
glFrustumf( FRUSTUM_LEFT * aspectRatio, FRUSTUM_RIGHT * aspectRatio,
FRUSTUM_BOTTOM, FRUSTUM_TOP,
FRUSTUM_NEAR, FRUSTUM_FAR );
glMatrixMode( GL_MODELVIEW );
// Switch to our projection matrix so that we can change it to ortho mode, not perspective.
glMatrixMode(GL_PROJECTION);
// Push on a new matrix so that we can just pop it off to go back to perspective mode
glPushMatrix();
glDisable( GL_DEPTH_TEST );
glDisable( GL_CULL_FACE );
// Reset the current matrix to our identify matrix
glLoadIdentity();
// Pass in our 2D ortho screen coordinates (left, right, bottom, top, near, far).
glOrthof( 0, 1, 0, 1, -1, 1 );
// Switch to model view so that we can render the texture
glMatrixMode(GL_MODELVIEW);
// Initialize the current model view matrix with the identity matrix
glLoadIdentity();
glPushMatrix();
// Enable vertex arrays.
glEnableClientState( GL_VERTEX_ARRAY );
// Set array pointers.
glVertexPointer( 2, GL_BYTE, 0, bgverts );
// Enable texture arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
// Set texture coords
glTexCoordPointer( 2, GL_BYTE, 0, bgtex );
glEnable(GL_TEXTURE_2D);
glBindTexture( GL_TEXTURE_2D, iTexturesID[0] );
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glPopMatrix();
// Load our projection matrix
glMatrixMode( GL_PROJECTION );
glEnable( GL_DEPTH_TEST );
glEnable( GL_CULL_FACE );
// Get rid of ortho mode which was lst pushed in the projection matrix mode
glPopMatrix();
// Go back to model view matrix
glMatrixMode( GL_MODELVIEW );
// Call eglSwapBuffers, which blit the graphics to the window
CImageConverterContainer* instance = (CImageConverterContainer*) this;
eglSwapBuffers( instance->iEglDisplay, instance->iEglSurface );
but the result is out of my expectation.[attachment=0:3seaevl5]001.jpg[/attachment:3seaevl5]
could anyone help me ? Thank you
Mia