PDA

View Full Version : OpenGL 3.x and vbo problem



Pswin
12-04-2011, 12:49 PM
hi

can i draw vbo/ibo in OpenGL 3.x without using vao?
or i must create a vao for all of my meshes?

big problem with vao is binding vbo and ibo for each vao and good thing is binding vertex attributes once, but in my game engine every mesh (a vbo and ibo ) draws with different shaders for example shadow shader only needs positions and drawing shader needs all data like as positions,normals and tex coordinates. problem with vao starts when i need to send diffrent vertex attributs to deffrent shaders (i must create a voa for every shader and every mesh in the scene)

Alfonse Reinheart
12-04-2011, 12:55 PM
You can just create a VAO at initialization time and bind it. VAO contents can change, after all.

thokra
12-05-2011, 12:14 AM
problem with vao starts when i need to send diffrent vertex attributs to deffrent shaders (i must create a voa for every shader and every mesh in the scene)

How different is different? Like Alfones said, you can alter the contents of a vertex array dynamically at runtime. Even if your vertex attributes change I don't think you have to pair one kind of VAO with a distinct shader. Could you give a concrete example of what you're describing? Smells like duplicated work.

tksuoran
12-06-2011, 02:34 AM
If you use BindAttribLocation, you can use a single VAO for any program/shader using a mesh data from a single vertex buffer.