Check my VAO code

Started by awside, February 24, 2012, 01:28:02

Previous topic - Next topic

awside

Vertices show up but the color is always white regardless.



        vao = ARBVertexArrayObject.glGenVertexArrays();
        ARBVertexArrayObject.glBindVertexArray(vao);
       
        vertexVBOID = ARBVertexBufferObject.glGenBuffersARB();
        ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vertexVBOID);
        ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vertexB, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
        ARBVertexShader.glVertexAttribPointerARB(0, 3, GL11.GL_FLOAT, false, 0, 0);
        ARBVertexShader.glEnableVertexAttribArrayARB(0);
        ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
       
        colorVBOID = ARBVertexBufferObject.glGenBuffersARB();
        ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, colorVBOID);
        ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, colorB, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
        ARBVertexShader.glVertexAttribPointerARB(1, 4, GL11.GL_FLOAT, false, 0, 0);
        ARBVertexShader.glEnableVertexAttribArrayARB(1);
        ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);


        Render code....

        ARBVertexArrayObject.glBindVertexArray(vao);
        GL11.glDrawArrays(GL11.GL_QUADS, 0, vertexCount / 3);