Take the 2-minute tour ×

OpenGL is very confusing for me and I'm not used to a lot of graphic terminology, etc. which is very rampant in many tutorials. I understand how to draw triangles, circles, and quads, polygons, etc. but now I'm trying to understand how textures work.

Could someone point me in the right direction for understanding textures?

Since I could only get JOGL to work in Netbeans, I tried putting an image, entitled "Tiki Mask" into the build path. When I ran this, it had no exception thrown so I assume it found the image file?

gl.glGenTextures(1, glu, 0);
    gl.glBindTexture(gl.GL_TEXTURE_2D, glu[1]);

    try {

        Texture tex = TextureIO.newTexture(new File("tikimask.jpg"), true);
        gl.glTexCoord2d(-tex.getWidth(), -tex.getHeight());
        gl.glVertex2d(-25, -25);
        gl.glTexCoord2d(-tex.getWidth(), tex.getHeight());
        gl.glTexCoord2d(tex.getWidth(), tex.getHeight());
        gl.glVertex2d(.05f, .05f);
        gl.glTexCoord2d(tex.getWidth(), -tex.getHeight());
        gl.glVertex2d(0, .05f);

    } catch (IOException ex) {
        Logger.getLogger(SimpleJOGLwee.class.getName()).log(Level.SEVERE, null, ex);
    } catch (GLException ex) {
share|improve this question
If you're still trying to learn OpenGL in Java, I would suggest these tutorials. They should give you a good understanding of textures and other OpenGL concepts, and they also use LWJGL which IMHO is better than JOGL. –  Forgive Goto Mar 17 '13 at 17:20
Also, your question isn't very clear. What exactly aren't you understanding? –  Forgive Goto Mar 17 '13 at 17:22
add comment

1 Answer

Your problem is that you never bound the texture that you loaded. Try adding these lines:


after you load the texture.

Also, I would recommend loading your texture in your init function, not your draw function, and then simply enable and bind them in your drawing function.

share|improve this answer
add comment

Your Answer


