|MarekKnows Discussion Forum
|Shader VMK 19 - Vertex Arrays
|Page 1 of 1|
|Author:||Marek [ Thu Jan 10, 2013 8:01 pm ]|
|Post subject:||Shader VMK 19 - Vertex Arrays|
In this vmk we explore vertex arrays which are part of the OpenGL v1.1 spec. By the end of the video you will learn how to store data in arrays and pass them all down to OpenGL in one call.
|Author:||Marek [ Sat Jan 26, 2013 7:29 am ]|
|Post subject:||Re: Shader VMK 19 - Vertex Arrays|
I forgot to go into details in the vmk on the differences in the buffer usage hint you can specify when creating your vertex arrays. Have a read through the OpenGL spec for details but to summarize:
Buffer Usage Hints
The usage parameter allows OpenGL to choose different strategies for storing the buffer depending on how your application intends to use the data. Each call to the glBufferData function provides a usage hint as the last parameter, and passing GL_STATIC_DRAW tells OpenGL that the contents of both buffers are never expected to change. This gives OpenGL more opportunities to optimize how and where the data is stored.
Other use cases:
If different attributes inside your vertex format require different usage patterns, split the vertex data into multiple structures, and allocate a separate vertex buffer object for each collection of attributes that share common usage characteristics. For example store position and color data in separate buffers. Vertex positions could be stored using GL_STATIC_DRAW and and the color buffer using the GL_DYNAMIC_DRAW hint. Then during run time you can modify the color on the fly and OpenGL will allocate that buffer so that your application maintains reasonable performance.
NOTE: In the example shown in the vmk, I don't actual change any data stored in the vertex array during run time so that is why I use GL_STATIC_DRAW.
|Page 1 of 1||All times are UTC - 5 hours|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group