Hello Guest

2D Texture Issue

  • 2 Replies
  • 3213 Views
*

Offline Orick

  • *
  • 2
  • Princes of the Universe
2D Texture Issue
« on: May 27, 2015, 01:32:27 »
Hi people, >:( I have a serious problem. As much I try I can't get display a texture with LWJGL 3.

For first I have this code for the texture method:

Code: [Select]
public static void DrawQuadText(Texture t, float x, float y, float width, float height){
t.bind();
glTranslatef(x, y, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(width, 0);
glTexCoord2f(1, 1);
glVertex2f(width, height);
glTexCoord2f(0, 1);
glVertex2f(0, height);
glLoadIdentity();
glEnd();
}
public static Texture LoadTexture(String path, String FileType){
Texture tex = null;
InputStream in = ResourceLoader.getResourceAsStream(path);
try {
tex = TextureLoader.getTexture(FileType , in);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return tex;
}

Then on the "while" I have this for draw the quad
Code: [Select]
Texture t = LoadTexture("com/princs/resc/AlphaGrass_64.png", "PNG");
while(glfwWindowShouldClose(window) == GL_FALSE){

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glfwPollEvents();

//Crear gáficos
DrawQuadText(t, 0, 0, 64, 64);

glFlush();
glfwSwapBuffers(window);

}

And finally the error:
Code: [Select]
Exception in thread "main" java.lang.NoSuchMethodError: org.lwjgl.opengl.GL11.glGetInteger(ILjava/nio/IntBuffer;)V
at org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer.glGetInteger(ImmediateModeOGLRenderer.java:194)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:317)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:200)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at com.princs.helpers.Art.LoadTexture(Art.java:42)
at com.princs.CreateWindow.glLoop(CreateWindow.java:49)
at com.princs.CreateWindow.main(CreateWindow.java:18)

And that is all, the error only pops up when I try run the program

*

Kai

Re: 2D Texture Issue
« Reply #1 on: May 27, 2015, 07:10:08 »
The external slick-util library (which you use to load the textures) is only compatible with LWJGL 2, not LWJGL version 3.
Have a look at:
http://forum.lwjgl.org/index.php?topic=5799.msg30862#msg30862
and
http://forum.lwjgl.org/index.php?topic=5784.msg30720#msg30720

*

Offline Orick

  • *
  • 2
  • Princes of the Universe
Re: 2D Texture Issue
« Reply #2 on: May 27, 2015, 15:59:03 »
The external slick-util library (which you use to load the textures) is only compatible with LWJGL 2, not LWJGL version 3.
Have a look at:
http://forum.lwjgl.org/index.php?topic=5799.msg30862#msg30862
and
http://forum.lwjgl.org/index.php?topic=5784.msg30720#msg30720
YEEEEEAHHHH!!! It works, I f*cking love you man, thanks for u help: