PDA

View Full Version : GL 3.3 core profile: Drawing w/hout VAO/VBOs



Godlike
11-01-2010, 03:59 AM
Hello,

I'm trying to draw a simple quad in an OpenGL 3.3 core profile application. As far as I know and according to the spec in order to draw something you have to create a VBO (or VBOs) attach them to a VAO and use the VAO to render. What a major pain. Is there a more simple way to do that?

kRogue
11-01-2010, 06:38 AM
Firstly, VAO state is mutable, so at application startup make one VAO and bind it. Then, from then on don't do any VAO calls and you can pretend the VAO requirement is gone.

The requirement of using VBO's for attribute data are there for a reason: for drawing geometry will lots of vertices, the VBO requirement has been present since GL3.0 forward profile.


If you just want to use GL to learn it and get comfortable with it, use GL3.x compatibility profile to recover glBegin/glEnd and the fixed function pipeline.

After a bit, you will use VBO's.

After a bit more you'll write your own shaders.

After a bit more, you'll be mostly happy with GL3 core profile.

Godlike
11-01-2010, 07:14 AM
Im pretty adept with OpenGL. I use VBOs (but no VAOs) almost everywhere and in some simple cases I use old school vertex arrays (eg for quad draw in the screen). I'm trying to port my engine to OpenGL 3.3 core and this implies that I have to ditch vertex arrays and change the way of rendering the VBOs by using VAOs.

The fact that the VAO is mutable really simplifies the whole thing. Bind once and use:
glEnableVertexAttribArray(...);
glVertexAttribPointer(...);
glDrawElements(...);
glDisableVertexAttribArray(...);

Thanks for the idea!