Forum Stats

  • 3,874,298 Users
  • 2,266,718 Discussions
  • 7,911,809 Comments

Discussions

App Breakdown at "gl.glTranslate3f" (Java Result: 139)

843799
843799 Member Posts: 49,999
edited Jan 6, 2010 10:23AM in Java 3D
Hi,
i have a very odd problem:
I loaded a TGA-picture to a ByteBuffer texture and created an texture by that:
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glGenTextures(1,tex,0);
gl.glBindTexture(GL.GL_TEXTURE_2D, tex[0]); 

gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
                    GL.GL_LINEAR);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
                    GL.GL_LINEAR);

int type=0;
if (image1.bitspp == 24)   // Was The TGA 24 Bits
    type = GL.GL_RGB;
else
    type = GL.GL_RGBA;
            

image1.imagedata.position(0);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, image1.width,
                   image1.height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE,
                   image1.imagedata);
this is not special at all. What is special, is the following:
In the "display"-method the programm breaks down at the second "gltranslate3f" with "Java Result 139" :
        GL gl = drawable.getGL();
       

        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
     
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity();
        
        gl.glTranslatef(-1.5f, 0.0f, -6.0f);
       
        // Drawing Using Triangles
        ...

        gl.glTranslatef(3.0f, 0.0f, 0.0f);            <-------_HERE IT BREAKS
        // Draw A Quad
        
        gl.glBindTexture(GL.GL_TEXTURE_2D, tex[0]);
        

        gl.glBegin(GL.GL_QUADS);
            gl.glColor3f(0.5f, 2f, 1.0f);  
            gl.glTexCoord2f(0.0f,0.0f);gl.glVertex3f(-1.0f, 1.0f, 0.0f); 
            gl.glTexCoord2f(0.1f,0.0f);gl.glVertex3f(1.0f, 1.0f, 0.0f);  
            gl.glTexCoord2f(0.1f,0.1f);gl.glVertex3f(1.0f, -1.0f, 0.0f);  
            gl.glTexCoord2f(0.0f,0.1f);gl.glVertex3f(-1.0f, -1.0f, 0.0f); 
        // Done Drawing The Quad
        gl.glEnd();

        gl.glFlush();
funny is, if i delete the

gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, image1.width,
image1.height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE,
image1.imagedata);

it works fine, but the texture isn't visible of course^^
what's the problem?

bye, Christoph

Edited by: Fachmann on Jan 6, 2010 7:22 AM
This discussion has been closed.