title: Error with OpenGL in Java
body: <p>I'm starting with lwjgl(2.9.1) in Java for 3D Game. When I have created the Display all was right, but when I have added the Loader, Renderer and RawModel class, java give me this error: </p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalStateException: Function is not supported
      at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
      at org.lwjgl.opengl.GL30.glGenVertexArrays(GL30.java:1550)
      at com.render.Loader.createVAO(Loader.java:39)
      at com.render.Loader.loadVAO(Loader.java:20)
      at com.Tester.MainLoop.main(MainLoop.java:29)
  </code></pre>
  
  <p>Someone can help me?</p>
  
  <p>This is my Java code:</p>
  
  <p>Renderer class:</p>
  
  <pre><code> public class Renderer{
  
      public void prepare(){
          GL11.glClearColor(1, 0, 0, 1);
          GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
      }
  
      public void render(RawModel model){
          GL30.glBindVertexArray(model.getVaoID());
          GL20.glEnableVertexAttribArray(0);
          GL11.glDrawArrays(GL11.GL_TRIANGLES,0,model.getVertexCount());
          GL20.glDisableVertexAttribArray(0);
          GL30.glBindVertexArray(0);
      }
  
  }
  </code></pre>
  
  <p>Loader class:</p>
  
  <pre><code>    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;();
  
      public RawModel loadVAO(float[] pos){
  
          int vaoID = createVAO();
          storeDataInAttributeList(0,pos);
          unbindVAO();
          return new RawModel(vaoID, pos.length/3);
  
      }
  
      public void cleanUp(){
          for(int vao:vaos){
              GL30.glDeleteVertexArrays(vao);
          }
  
          for(int vbo:vbos){
              GL15.glDeleteBuffers(vbo);
          }
      }
  
      private int createVAO(){
  
          int vaoID = GL30.glGenVertexArrays();
          vaos.add(vaoID);
          GL30.glBindVertexArray(vaoID);
          return vaoID;
  
      }
  
      private void storeDataInAttributeList(int attrNum, 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_STATIC_DRAW);
          GL20.glVertexAttribPointer(attrNum, 3, GL11.GL_FLOAT, false, 0, 0);
          GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
      }
  
      private void unbindVAO(){
          GL30.glBindVertexArray(0);
      }
  
      private FloatBuffer storeDataInFloatBuffer(float[] data){
          FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
          buffer.put(data);
          buffer.flip();
          return buffer;
      }
  
  
  
  }
  </code></pre>
  
  <p>RawModel class:</p>
  
  <pre><code>    public class RawModel {
  
      private int vaoID;
      private int vertexCount;
  
      public RawModel(int id, int num){
  
          this.vaoID = id;
          this.vertexCount = num;
  
      }
  
      public int getVaoID(){
          return this.vaoID;
      }
  
      public int getVertexCount(){
          return this.vertexCount;
      }
  
  }
  </code></pre>
  
  <p>DisplayManager class:</p>
  
  <pre><code>    public class DisplayManager{
  
      private static final int width = 1280;
      private static final int height = 1280;
      private static final int fps = 120;
  
      public static void createDisplay(){
  
          ContextAttribs attribs = new ContextAttribs(3,2).withForwardCompatible(true).withProfileCore(true);
  
          try{
              System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true"); 
              Display.setDisplayMode(new DisplayMode(width,height));
              Display.create(new PixelFormat(), attribs);
              Display.setTitle("OpenGL 3D Game");
          }catch(LWJGLException e){
              e.printStackTrace();
          }
  
          GL11.glViewport(0, 0, width, height);
      }
  
      public static void updateDisplay(){
  
          Display.sync(fps);
          Display.update();
  
      }
  
      public static void closeDisplay(){
  
          Display.destroy();
  
      }
  
  }
  </code></pre>
  
  <p>MainLoop class:</p>
  
  <pre><code>    public class MainLoop{
  
      public static void main(String[] args){
  
          DisplayManager.createDisplay();
  
          Loader loader = new Loader();
          Renderer renderer = new Renderer();
  
          float[] vert = {
                  -0.5f,0.5f,0f,
                  -0.5f,-0.5f,0f,
                  0.5f,-0.5f,0f,
  
                  0.5f,-0.5f,0f,
                  0.5f,0.5f,0f,
                  -0.5f,0.5f,0f
          };
  
          RawModel model = loader.loadVAO(vert);
  
          while(!Display.isCloseRequested()){
  
              renderer.prepare();
  
              renderer.render(model);
  
              DisplayManager.updateDisplay();
  
          }
  
          loader.cleanUp();
          DisplayManager.closeDisplay();
  
      }
  
  }
  </code></pre>