LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: bloobchube on May 18, 2015, 11:29:55

Title: LWJGL 2: Loading PNGs?
Post by: bloobchube on May 18, 2015, 11:29:55
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.
Title: Re: LWJGL 2: Loading PNGs?
Post by: Cornix on May 18, 2015, 12:50:10
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.