Problems with Textures...

Please help… it seems that there are only a very limited number of .png files that I can display with java. I dont know what it is, but some png’s just wont display. They are all in a size ^2, so its not that…

Please help, I am goin spare!

Thanks in advance

Music_Man

Do you enabled GL_TEXTURE_2D ?
Do you set texture coordinates ?
Pay attention to the format you used when created texture with glTexImage2D() or gluBuild2DMipmaps()

Bye

What do you use for your PNG loading? Perhaps that routine doesn’t correctly handle certain forms of PNGs.

Cheers for the replies, I am now using MS Paint of all things to convert the images to png. It seems to be working except for the fact that it will only display the last texture that I have loaded… My code is below, please help…

    public void LoadGLTextures() 
    { 
       PngTextureLoader texLoader = new PngTextureLoader(gl, glu);
       texLoader.readTexture(getCodeBase(), "MetalFloor.PNG");
       if(texLoader.isOk())  { 
       //Create Texture 
       gl.glGenTextures(5, texture);
       gl.glBindTexture(GL_TEXTURE_2D, texture[0]);
       gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
       gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
       gl.glTexImage2D( GL_TEXTURE_2D, 0, 3, texLoader.getImageWidth(), 
                        texLoader.getImageHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE,
                        texLoader.getTexture()); 
       }

// PngTextureLoader texLoader2 = new PngTextureLoader(gl, glu);
texLoader.readTexture(getCodeBase(), “Marble.png”);
if(texLoader.isOk()) {
//Create Texture
gl.glGenTextures(5, texture);
gl.glBindTexture(GL_TEXTURE_2D, texture[1]);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl.glTexImage2D( GL_TEXTURE_2D, 0, 3, texLoader.getImageWidth(),
texLoader.getImageHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE,
texLoader.getTexture());
}

    } 

Again, many thanks in advance

Music_Man

It’s ok now. Cheers for all the help, my housemate just walked in, looked at my code and went 'ooo, you dont need the gl.glGenTextures(5, texture);
bit in there twice… took it out and it worked fine… i’m just gonna go bang my head against a brick wall…

Cheers

Music_Man :slight_smile: