Login  Register

Re: Loading texture doesn't work with the correct texture width/height

Posted by WarrenFaith on Jan 27, 2011; 4:21pm
URL: https://forum.jogamp.org/Loading-texture-doesn-t-work-with-the-correct-texture-width-height-tp2362327p2363105.html

That gave me the right direction...

my solution:

Texture texture;

private void initTexture(GL2ES2 gl) {
    try {
        texture = TextureIO.newTexture(new URI("http://192.168.0.39/images/box.gif").toURL(),true,null);
        texture.setTexParameterf(GL2ES2.GL_TEXTURE_MIN_FILTER, GL2ES2.GL_LINEAR_MIPMAP_LINEAR);
        texture.setTexParameterf(GL2ES2.GL_TEXTURE_MAG_FILTER, GL2ES2.GL_LINEAR);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

public void display(GL2ES2 gl) {
    // code snipped
    if (texture != null) {
        texture.enable();
        texture.bind();
    }
    // code snipped
}