title: Fixing Incompatibility Between LWJGL 3 and Slick-Util
body: <p>What I am trying to do is map a texture to an OpenGL model within LWJGL. I know that LWJGL 3 and slick-util sometimes work together and sometimes don't. In my case, it works a little and then tries to access a method in OpenGL that doesn't exist anymore for LWJGL 3. My posting this isn't necessarily trying to fix this error, but to find a way to circumvent it. I have tried downgrading to/running LWJGL 2 instead of/with LWJGL 3 and that went terribly, and I've also tried my hand at a couple of different PNG decoders to get what I want, but I can't figure them out. Also, I have went and gotten the "LWJGL 3 Compatible slick-util" but it doesn't have any classes/methods in it that I need. If anyone can fix my code for me or tell me how to fix it myself, that'd be lovely.</p>
  
  <p>Here's the error:</p>
  
  <pre><code>Mon Feb 15 18:38:13 EST 2016 INFO:Use Java PNG Loader = true
  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 Graphics.Loader.loadTexture(Loader.java:37)
      at Graphics.LaunchWindow.loop(LaunchWindow.java:116)
      at Graphics.LaunchWindow.run(LaunchWindow.java:43)
      at Graphics.LaunchWindow.main(LaunchWindow.java:155)
  </code></pre>
  
  <p>Here's the LaunchWindow class:</p>
  
  <pre><code>package Graphics;
  
  import org.lwjgl.glfw.*;
  import org.lwjgl.opengl.*;
  import org.lwjgl.util.Display;
  
  import Controls.KeyParser;
  import Controls.KeyboardInput;
  import Controls.MouseInput;
  import Controls.MouseParser;
  import Graphics.Shaders.StaticShader;
  import Controls.Cursor;
  import Models.Model1;
  import Models.RawModel;
  import Models.TexturedModel;
  import Textures.ModelTexture;
  
  import static org.lwjgl.glfw.GLFW.*;
  import static org.lwjgl.opengl.GL11.*;
  import static org.lwjgl.system.MemoryUtil.*;
  
  import java.nio.ByteBuffer;
  
  @SuppressWarnings("unused")
  public class LaunchWindow {
  
  private GLFWErrorCallback errorCallback;
  private GLFWKeyCallback   keyCallback;
  private GLFWMouseButtonCallback mouseButtonCallback;
  private GLFWCursorPosCallback cursorPosCallback;
  
  public int width = 1024;
  public int height = 600;
  public String title = "Duplicity";
  public long fullscreen = NULL;
  public long window;
  private Cursor cursor;
  
  public void run() {
  
      try {
          init();
          loop();
          glfwDestroyWindow(window);
          keyCallback.release();
      } finally {
          glfwTerminate();
          errorCallback.release();
      }
  }
  
  private void init() {
  
      glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
  
      KeyboardInput.initiate();
      MouseInput.initiateMouse();
  
      if ( glfwInit() != GLFW_TRUE )
          throw new IllegalStateException("Unable to initialize GLFW");
  
      if(fullscreen == NULL){
          glfwDefaultWindowHints();
          glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
          glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
      }
  
      window = glfwCreateWindow(width, height, title, fullscreen, NULL);
      if (window == NULL)
          throw new RuntimeException("Failed to create the GLFW window");
  
      glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() {
          @Override
          public void invoke(long window, int key, int scancode, int action, int mods) {
              if ( key == GLFW_KEY_ESCAPE &amp;&amp; action == GLFW_RELEASE )
                  glfwSetWindowShouldClose(window, GLFW_TRUE);
          }
      });
  
      GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
      glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2);
      glfwMakeContextCurrent(window);
      glfwSwapInterval(1);
      glfwShowWindow(window);
  
      keyCallback = GLFWKeyCallback.create(KeyboardInput::glfw_key_callback);
      keyCallback.set(window);
  
      mouseButtonCallback = GLFWMouseButtonCallback.create(MouseInput::glfw_mouse_button_callback);
      mouseButtonCallback.set(window);
  
      cursorPosCallback = GLFWCursorPosCallback.create(MouseInput::glfw_cursor_pos_callback);
      cursorPosCallback.set(window);
  
      cursor = new Cursor(Cursor.Standard.ARROW);
      glfwSetCursor(window, cursor.getCursor());
  
      GL.createCapabilities();
  }
  
  public void updateInput() {
      KeyboardInput.update();
      MouseInput.update();
      glfwPollEvents();
  }
  
  public void loop() {
  
      Loader loader = new Loader();
      Render render = new Render();
      Model1 model1 = new Model1();
      Display display = new Display();
      StaticShader shader = new StaticShader();
  
      RawModel model = loader.loadToVAO(model1.Model1Vertices(), model1.Model1Indices());
      ModelTexture texture = new ModelTexture(loader.loadTexture("marble"));
      TexturedModel texturedModel = new TexturedModel(model, texture);
  
      GL.createCapabilities();
      //glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  
      if(width != 1024 &amp;&amp; height != 600){
          System.out.println("resized");
      }
  
      while ( glfwWindowShouldClose(window) == GLFW_FALSE ) {
          render.prepare();
          shader.start();
          render.render(texturedModel);
          shader.stop();
  
          //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          glfwSwapBuffers(window); 
          glfwPollEvents();
          try {
              new KeyParser().checkKeyState();
              new MouseParser().checkMouseState();
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
      }
      shader.cleanUp();
      loader.cleanUp();
  }
  public void setCursor(Cursor cursor) {
      this.cursor = cursor;
      glfwSetCursor(window, cursor.getCursor());
  }
  
  public Cursor getCursor() {
      return cursor;
  }
  
  public static void main(String[] args) {
      new LaunchWindow().run();
  }
  
  }
  </code></pre>
  
  <p>And here's Loader:</p>
  
  <pre><code>package Graphics;
  
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.nio.FloatBuffer;
  import java.nio.IntBuffer;
  import java.util.ArrayList;
  import java.util.List;
  
  import org.lwjgl.BufferUtils;
  import org.lwjgl.opengl.GL11;
  import org.lwjgl.opengl.GL15;
  import org.lwjgl.opengl.GL20;
  import org.lwjgl.opengl.GL30;
  import org.newdawn.slick.opengl.Texture;
  import org.newdawn.slick.opengl.TextureLoader;
  
  import Models.RawModel;
  
  public class Loader {
  
  private List&lt;Integer&gt; vaos = new ArrayList&lt;Integer&gt;();
  private List&lt;Integer&gt; vbos = new ArrayList&lt;Integer&gt;();
  private List&lt;Integer&gt; textures = new ArrayList&lt;Integer&gt;();
  
  public RawModel loadToVAO(float[] positions, int[] indices){
      int vaoID = createVAO();
      bindIndicesBuffer(indices);
      storeDataInAttributeList(0, positions);
      unbindVAO();
      return new RawModel(vaoID, indices.length);
  }
  
  public int loadTexture(String fileName){
      Texture texture = null;
      try {
          texture = TextureLoader.getTexture("PNG", new FileInputStream("res/" + fileName + ".png"));
      } catch (IOException e) {
          e.printStackTrace();
      }
      int textureID = texture.getTextureID();
      textures.add(textureID);
      return textureID;
  }
  
  public void cleanUp(){
      for(int vao:vaos){
          GL30.glDeleteVertexArrays(vao);
      }
      for(int vbo:vbos){
          GL15.glDeleteBuffers(vbo);
      }
      for(int texture:textures){
          GL11.glDeleteTextures(texture);
      }
  }
  
  private int createVAO(){
      int vaoID = GL30.glGenVertexArrays();
      vaos.add(vaoID);
      GL30.glBindVertexArray(vaoID);
      return vaoID;
  }
  
  private void storeDataInAttributeList(int attNumber, float[] data){
      int vboID = GL15.glGenBuffers();
      vbos.add(vboID);
      GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID);
      FloatBuffer buffer = storeDataInFloatBuffer(data);
      GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_DYNAMIC_DRAW); //change to static if static model
      GL20.glVertexAttribPointer(attNumber, 3, GL11.GL_FLOAT, false, 0, 0);
      GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
  }
  
  private void unbindVAO(){
      GL30.glBindVertexArray(0);
  }
  
  private void bindIndicesBuffer(int[] indices){
      int vboID = GL15.glGenBuffers();
      vbos.add(vboID);
      GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboID);
      IntBuffer buffer = storeDataInIntBuffer(indices);
      GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, buffer, GL15.GL_DYNAMIC_DRAW); //change to static of static model
  }
  
  private IntBuffer storeDataInIntBuffer(int[] data){
      IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
      buffer.put(data);
      buffer.flip();
      return buffer;
  }
  
  private FloatBuffer storeDataInFloatBuffer(float[] data){
      FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
      buffer.put(data);
      buffer.flip();
      return buffer;
  }
  
  }
  </code></pre>