Hi!
I’m trying to copy part of screen and put in a texture, but never works exactly.
I had changed modelview matrix to use in 2d app, ‘gl.glOrtho( 0, width, height, 0, 0, 1 );’. When I draw the point (0,0) is (top, left), but when I call to copyTex, the (0,0) is (bottom, left). Then, the image is inverted.
http://img132.imageshack.us/img132/4109/glcopyteximage2dbfi8.jpg
the display code:
GL gl = drawable.getGL();
gl.glClear( GL.GL_COLOR_BUFFER_BIT );
gl.glViewport( 0, 0, width, height );
texture2.bind();
// gl.glColor3f( 0, 0, 0 );
gl.glBegin( GL.GL_QUADS );
gl.glTexCoord2f( 0, 0 );
gl.glVertex2f( 0, 0 );
gl.glTexCoord2f( 0, 1 );
gl.glVertex2f( 0, 128 );
gl.glTexCoord2f( 1, 1 );
gl.glVertex2f( 128, 128 );
gl.glTexCoord2f( 1, 0 );
gl.glVertex2f( 128, 0 );
gl.glEnd();
texture1.bind();
gl.glCopyTexImage2D( GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, 0, height - 128, 128, 128, 0 );
gl.glBegin( GL.GL_QUADS );
gl.glTexCoord2f( 0, 0 );
gl.glVertex2f( 100, 100 );
gl.glTexCoord2f( 0, 1 );
gl.glVertex2f( 100, 228 );
gl.glTexCoord2f( 1, 1 );
gl.glVertex2f( 228, 228 );
gl.glTexCoord2f( 1, 0 );
gl.glVertex2f( 228, 100 );
gl.glEnd();
I really don’t have any idea about this!