Jump to content
  • Advertisement
Sign in to follow this  
rumpfi88

OpenGL multiple vertex arrays and one shader program

This topic is 977 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?

 

lg

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!