I don’t know, i would like to try someone else code in order. Here it is the code. I have omitted all, i was trying to draw a simple quad but it crashes anyway
(i have taken this code from another forum, it use only a 256x256 texture, but i tought that was a good starting point)
//==========================================
// BACKGROUND PLANE
static const GLbyte bgverts[8] =
//static const GLfloat bgverts[8] =
{
/*0, 0,
1.06, 0,//1, 0,
0, 0.8,//0, 1,
1.06, 0.8//1, 1
*/
0, 0,
1, 0,
0, 1,
1, 1
};
static const GLubyte bgtex[8] =
{
0, 1,
1, 1,
0, 0,
1, 0
};
void RenderTexturedBG(TUint8* aCamFrameData)
{
GLuint iTexturesID[10];
/*
// Textures are initialized in OpenGL ES API by this function.
glGenTextures( 1, iTexturesID );
glBindTexture( GL_TEXTURE_2D, iTexturesID[0] );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 256,
0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)aCamFrameData );
//glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 256, 256,
// 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)aCamFrameData );
glTexEnvx( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);*/
// Before drawing the background texture, we need to switch to ortho (2D) mode.
// Passing 1 instead of the implicit size of screen will make OpeGL use the full size of screen (1:1)
//OrthoMode(0, 1, 0, 1);
// 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( aLeft, aRight, aBottom, aTop, -1, 1 );
glOrthof(0, 1, 0, 1, -1, 1);
//glOrthof(0, 1/0.8, 0, 1/0.53, -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();
//glEnable(GL_TEXTURE_2D);
//DrawBGPoly();
//glPushMatrix();
// Enable vertex arrays.
//glEnableClientState( GL_VERTEX_ARRAY );
// Set array pointers.
glVertexPointer( 2, GL_BYTE, 0, bgverts );
//glVertexPointer( 2, GL_FLOAT, 0, bgverts);
// Enable texture arrays
//glEnableClientState( GL_TEXTURE_COORD_ARRAY );
// Set texture coords
//glTexCoordPointer( 2, GL_BYTE, 0, bgtex );
//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();
//PerspectiveMode();
// 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 );
//glDeleteTextures(1, iTexturesID);
}