LWJGL 2: Loading PNGs?

Started by bloobchube, May 18, 2015, 11:29:55

Previous topic - Next topic

bloobchube

Hello,
Every time I try to load a png using this method:

public static Texture loadTexture(String path){
     try {
      return TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(path));
   } catch (IOException e) {
      e.printStackTrace();
      return null;
   }
  }

I get this in my console and a black screen:

WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data

Any ideas? Thanks.

Cornix

That has nothing to do with LWJGL, if you have a problem with the Slick2D library you should try to find help in a Slick2D support forum.
If you cant get it to work I would recommend using the PNGDecoder by Mathias Mann. I am using it myself and it is pretty good and very reliable.