Vertex and index buffer

BlitzMax Forums/OpenGL Module/Vertex and index buffer

Ferret(Posted 2011) [#1]
I'm trying to understand the VBO but have a problem with mi test app.

If i understand correctly i need to create a vertex buffer and a index buffer?

Creating a vertex buffer seems to work but mi app crashes when i add a index buffer.



Last edited 2011


AdamRedwoods(Posted 2011) [#2]
It's not easy to tell without running the program, but at a quick glance you need to make sure:
glBufferData( .. , Size, .., ..) where size is in BYTES. So a SHORT = Sizeof(short)*2, INT = Sizeof(int)*4, FLOAT = Sizeof(float)*4 , etc.


Ferret(Posted 2011) [#3]
I read another tutorial and no index buffer is used, only vertex buffer.

How do i know i'm drawing from the vertex buffer?
If i bind the buffer and draw using glDrawElements() and indices, am i drawing from the buffer?

I did some test with 10K triangles and see no difference in performance.


Ferret(Posted 2011) [#4]
Got it to work :)