Can't load a texture for OpenGL

Started by EinDounat, December 09, 2014, 18:01:30

Previous topic - Next topic

EinDounat

Hello LWJGL community!

I have a problem: I created a class to initialize OpenGL Textures automatically, but I get an error when I am loading it. Here is the code, where the program gets stuck:

private void initializeOpenGLTexture() {
		try {
			this.texture = BufferedImageUtil.getTexture("/res/textures/" + filename + ".png", this.rawTexture);
		} catch (IOException e) {
			logger.error("Couldn't load the image into a BufferedImage.");
			logger.error(e.getMessage());
		}
	}


Before this function, the program loads and stores the picture into a BufferedImage. Here is the exception it will throw at line 3 of the code above:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Expected static method org.lwjgl.opengl.GLContext.getCapabilities()Lorg/lwjgl/opengl/ContextCapabilities;
	at org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer.canTextureMirrorClamp(ImmediateModeOGLRenderer.java:408)
	at org.newdawn.slick.util.BufferedImageUtil.getTexture(BufferedImageUtil.java:124)
	at org.newdawn.slick.util.BufferedImageUtil.getTexture(BufferedImageUtil.java:39)
	at org.dounat.Mythmon.Graphics.GLImage.initializeOpenGLTexture(GLImage.java:...


I can't find something on the internet to solve this problem and I done everything to understand why it throws there an exception but I couldn't manage it to solve this problem. How can I solve it?

Thanks in advance,
~ EinDounat

abcdef

You should post this in the slick forums, it isn't really anything to do with LWJGL

The error is related to

http://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html

are you trying to make slick work in LWJGL3? If so this might be your issue as static methods could have been moved to non-static. I'd recommend to use an older lwjgl that slick is compatible with

Zeroni

I suggest you use TWL's PNG Decoder. It has a creative commons license. You can find TWL's PNG Decoder and Tutorial here.
- Zeroni

EinDounat

Quote from: abcdef on December 10, 2014, 09:21:21
You should post this in the slick forums, it isn't really anything to do with LWJGL

The error is related to

http://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html

are you trying to make slick work in LWJGL3? If so this might be your issue as static methods could have been moved to non-static. I'd recommend to use an older lwjgl that slick is compatible with

Thanks for your answer. This would help me out but I think I will follow the next answer:

Quote from: Zeroni on December 10, 2014, 10:24:47
I suggest you use TWL's PNG Decoder. It has a creative commons license. You can find TWL's PNG Decoder and Tutorial here.

Thanks for your suggestion, I am going to read the tutorial now.