-1
bi = ImageIO.read(new File(filename));
width = bi.getWidth();
height = bi.getHeight();
            
ByteBuffer data = stbi_load("/sprites/" + filename, width, height, 0, 0);

For some reason, stbi_load isn't accepting the second, third, and fourth parameters in the method, even though they're all valid integers. It gives the following error

The method stbi_load(ByteBuffer, IntBuffer, IntBuffer, IntBuffer, int) in the type STBImage is not applicable for the arguments (String, int, int, int, int).

Any ideas why this is happening? Any answers are appreciated

ralph367
  • 3
  • 4

1 Answers1

0

Could you please show the stbi_load method signature.

Maybe it expects arguments of types ByteBuffer and IntBuffer, not of types String and int as you provided.

Peasant
  • 36
  • 3
  • The method stbi_load(ByteBuffer, IntBuffer, IntBuffer, IntBuffer, int) in the type STBImage is not applicable for the arguments (String, int, int, int, int). Thats the method signature, so ye it does expect the types u mentioned above, but why is it asking for those instead of the regular string and ints? – ralph367 Dec 01 '21 at 14:19
  • 1
    Because the [STBImage class](https://javadoc.lwjgl.org/org/lwjgl/stb/STBImage.html) was designed that way. – Peasant Dec 01 '21 at 14:50