Java lwjgl GLSL shader issue with mac osx Validation Failed: No vertex array object bound : <p>I am building OPENGL application in Java using <a href="https://www.lwjgl.org/" rel="nofollow noreferrer">lwjgl</a> and following part of tutorial on YouTube by <a href="https://www.youtube.com/watch?v=DJnzafkmuTA&amp;list=PLEETnX-uPtBXP_B2yupUKlflXBznWIlL5&amp;index=9" rel="nofollow noreferrer">thebennybox</a></p>

<p>I am able to create rectangle using Mesh class i build. </p>

<pre><code>import engine.core.Util;

import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;

public class Mesh {

    private int vbo;
    private int size;

    public Mesh() {
       this.vbo = glGenBuffers();
       this.size = 0;
    }

    public void addVertices(Vertex[] vertices){
        this.size = vertices.length * Vertex.SIZE;
        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glBufferData(GL_ARRAY_BUFFER, Util.createFlippedBuffer(vertices), GL_STATIC_DRAW);
    }

    public void draw(){
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SIZE * 4, 0);
        glDrawArrays(GL_TRIANGLES, 0, this.size);
        glDisableVertexAttribArray(0);
    }
}
</code></pre>

<p>And <code>util</code> helper</p>

<pre><code>import engine.render.Vertex;
import org.lwjgl.BufferUtils;

import java.nio.FloatBuffer;

public class Util {

    public static FloatBuffer createFloatBuffer(int size){
        return BufferUtils.createFloatBuffer(size);
    }

    public static FloatBuffer createFlippedBuffer(Vertex[] vertices){

        FloatBuffer buffer = createFloatBuffer(vertices.length * Vertex.SIZE);

        for(int i = 0; i &lt; vertices.length; i++) {
            buffer.put(vertices[i].getPos().getX());
            buffer.put(vertices[i].getPos().getY());
            buffer.put(vertices[i].getPos().getZ());
        }

        buffer.flip();
        return buffer;
    }
}
</code></pre>

<p>Here is how i am rendering</p>

<pre><code>  this.mesh = new Mesh();

   Vertex[] data = new Vertex[]{
           //1st triangle
           new Vertex(new Vector3(0.5f,-0.5f,0)), //RB
           new Vertex(new Vector3(-0.5f,-0.5f,0)), //LB
           new Vertex(new Vector3(0.5f,0.5f,0)), //RT
           //2nd triangle
           new Vertex(new Vector3(-0.5f,0.5f,0)), //RB
           new Vertex(new Vector3(0.5f,0.5f,0)), //RT
           new Vertex(new Vector3(-0.5f,-0.5f,0)), //LB
   };

   mesh.addVertices(data);

   public void render(){ //update per frame
     mesh.draw();
   } 
</code></pre>

<p>So far it worked. Then I followed tutorial for shader and got error</p>

<blockquote>
  <p>Validation Failed: No vertex array object bound.</p>
</blockquote>

<p>Here is shader class</p>

<pre><code>import static org.lwjgl.opengl.GL32C.*;

public class Shader {

    private int program;

    public Shader() {
        program = glCreateProgram();

        if(program == 0){
            System.out.println("Shader creation failed!");
            System.exit(1);
        }
    }


    public void addVertexShader(String text){

        //System.out.println(text);
        addProgram(text, GL_VERTEX_SHADER);
    }

    public void addGeometryShader(String text){
        addProgram(text, GL_GEOMETRY_SHADER);
    }

    public void addFragmentShader(String text){
        addProgram(text, GL_FRAGMENT_SHADER);
    }

    public void bind(){
        glUseProgram(program);
    }

    public void compileShader(){

        glLinkProgram(program);

        if(glGetProgrami(program, GL_LINK_STATUS) == 0){
            System.out.println(glGetProgramInfoLog(program, 1024));
            System.exit(1);
        }

        glValidateProgram(program);

        if(glGetProgrami(program, GL_VALIDATE_STATUS) == 0){

           // System.out.println("ffff");
            System.out.println( glGetProgramInfoLog(program, 1024));
            System.exit(1);
        }

    }

    public void addProgram(String text, int type){

        int shader = glCreateShader(type);

        if(shader == 0){
            System.out.println("Shader creation failed!");
            System.exit(1);
        }

        glShaderSource(shader, text);
        glCompileShader(shader);

        if(glGetShaderi(shader, GL_COMPILE_STATUS) == 0){
            System.out.println(glGetShaderInfoLog(shader, 1024));
            System.exit(1);
        }

        glAttachShader(program, shader);

    }
}
</code></pre>

<p>And here is ResourceLoader</p>

<pre><code>  import java.io.BufferedReader;
  import java.io.FileReader;

  public class ResourceLoader {

      public static String loadShader(String fileName){

          StringBuilder shaderSource = new StringBuilder();
          BufferedReader shaderReader = null;

          try {
              shaderReader = new BufferedReader(new FileReader(fileName));
              String line;
              while ((line = shaderReader.readLine()) != null){
                  shaderSource.append(line).append("\n");
              }
          } catch (Exception e){
              System.out.println(e.getMessage());
          }

          return shaderSource.toString();
      }
  }
</code></pre>

<p>GLSL CODE FOR BOTH FILE</p>

<pre><code>  ==== basicVertex.glsl
  #version 410 core

  out vec4 outColor;

  void main(){
  outColor = vec4(0.0, 1.0, 1.0, 1.0);
  }

  =========  basicFragment.glsl
  #version 410 core

  layout (location = 0) in vec3 position;


  void main(){
      gl_Position = vec4(position, 1.0);
  }
</code></pre>
