Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  problem using glCopyTexImage2D in ogl2d  (Read 515 times)
0 Members and 1 Guest are viewing this topic.
Offline orlleite

JGO n00b
*

Posts: 4



« on: 2009-02-14 18:44:31 »

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. Sad




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.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!
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.101 seconds with 20 queries.