It makes perfectly sens.

Thank you,


Le 07/18/10 22:10, Gijs a écrit :
There certainly won't be any memory leak or corruption. This is the default operation of most, if not all, commands of OpenGL. OpenGL works like a big giant state-machine. You set something, and it'll stay set until you change it or you pop/push states/settings. In your case, a VBO buffer can be bound so that it is made active, and then the commands that use VBO's will use the binded VBO buffer you've set before. If you never unset it, then OpenGL will simply assume that you still want the VBO buffer to be active.

An easier to understand example is when you want to draw a green triangle for instance. If you need to draw a green triangle, and never have to draw a different color, then you can simply set the color to be green before the drawing function. Then call the drawing function, and the color will remain green throughout the entire drawing function. You can call the drawing function again and again, without ever having to set the color to be green. (well, unless you are popping and pushing states which erases states/settings you've set before).

If you understand this concept, you can make quite efficient code, since you know you don't have to call certain functions again and again, simply because they don't (have to) change. And OpenGL usually doesn't change settings for you. There's only one exception to this afaik. When you make an FBO active, it replaces the current settings with the settings of the FBO you made active. Not all of your settings, but the ones that have to do with the colorbuffer and viewport. If you're not sure what settings are set at a certain point in your code, you can get the settings with functions like glGetBooleanv, glGetDoublev, glGetFloatv, glGetIntegerv.

Hope this helps and makes some sense :)
Kind regards,

On 18-7-2010 19:16, Roland Everaert wrote:
Thanks after a few try and error I was able to convert my code to use that class.

I have anyway a question regarding VBO usage in general.

What is the effect of not unbinding a VBO buffer after drawing and calling the drawing process again and again?

memory leak?

memory corruption?




Le 07/16/10 20:48, Ian Mallett a écrit :
That was a complete example of how to use the functions :-)

Here, I've added enough surrounding code to be self-explanatory. 

#Import it:
from OpenGL.arrays import vbo
import numpy as np
#Create a vertex buffer object
vertices = [  [0,0,0],[0,1,0],[1,0,0],  [2,0,0],[0,3,0],[4,9,6],  [7,8,1],...]
vertex_buffer_object = vbo.VBO(np.array(vertices,"f"),usage='GL_STATIC_DRAW')

#Draw VBO
glEnableClientState(GL_VERTEX_ARRAY); glVertexPointerf(vertex_buffer_object)


Normal, and texture VBOs work very similarly.  Vertex attribute VBOs require you to specify a shader, but you'll only need those for things like normal mapping, etc.

If you need more explanation, try:, or Google: "from OpenGL.arrays import vbo".  My implementation is here:, in glLib/ (class glLibObject) but it's probably too convoluted for a tutorial. 

------------------------------------------------------------------------------ This email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit --
_______________________________________________ PyOpenGL Homepage _______________________________________________ PyOpenGL-Users mailing list