I have created the checkImage ( 5122564)
and I want to get the image(come from the live image) using glTexSubImage2d()
but I got no image , and I am sure the format of the image is RGBA(A == 1)
here is the code , where is wrong?
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glBindTexture( GL_TEXTURE_2D, glid );
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,TestWidth,TestHeight,0,GL_RGBA,GL_UNSIGNED_BYTE,checkImage);
glBegin(GL_QUADS );
glTexCoord2f( 0.0, 0.0 ); glVertex2f( 0,0 );
glTexCoord2f( 0, 1 ); glVertex2f(0,256 );
glTexCoord2f( 1,1 ); glVertex2f( 512, 256 );
glTexCoord2f( 1,0 ); glVertex2f( 512,0 );
glEnd();
…
glBindTexture( GL_TEXTURE_2D, glid );
glTexSubImage2D( GL_TEXTURE_2D, 0, 0,0, 320,240, GL_RGBA, GL_UNSIGNED_BYTE,image);
glBegin(GL_QUADS );
glTexCoord2f( 0.0, 0.0 ); glVertex2f( 0,0 );
glTexCoord2f( 0, 1 ); glVertex2f(0,gImYsize);
glTexCoord2f( 1,1 ); glVertex2f( gImXsize, gImYsize );
glTexCoord2f( 1,0 ); glVertex2f( gImXsize,0 );
glEnd();
Thanks in advance