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.


the display code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| GL gl = drawable.getGL(); gl.glClear( GL.GL_COLOR_BUFFER_BIT ); gl.glViewport( 0, 0, width, height ); texture2.bind(); 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!