Advertisement Jump to content
Sign in to follow this  

OpenGL multiple vertex arrays and one shader program

This topic is 1160 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello community,


I'm experimenting a bit with vertex arrays, buffers and shaders. Because there was an option in glGenVertexArrays() that i can generate more than 1 vertex array, so i thought why not using 1 vertex array for 1 object, 3 vertex arrays for 3 objects etc.


My plan:


  • Objects
    • arrays which stores vertexes, normals and colors
    • vertex array object generated with glGenVertexArray() and bound with glBindVertexArray()
    • vertex buffer, normal buffer and color buffer generated, bound and stored with glBufferData()
    • array for transformation matrix
    • shader program to be used (compiled, attached and linked in Renderer)
    • render function which binds vertex array and uses shader program of this object
  • Renderer
    • basic GL (glClearColor()) settings when rendering in window
    • array for viewing and projection matrix
    • vertex and fragment shader compiled
    • shader program attached with vertex and fragment shader
    • render loop which renders Objects

Programming everything in one go (like you see in any OpenGL 3.3+ Tutorial) works fine (beautiful cube), but I don't see any objects in the window with the same verteces, normals colors and shaders. Is it possible that I need to bind a vertex array so that i can link a shader program?



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!