Re: [PyOpenGL-Users] VBOs and gl*Pointer offset parameter
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2009-07-16 18:50:12
|
renaud blanch wrote: > hello, > > i start to experiment with VBOs to prepare some code to the future of opengl :) > i try to use a single array buffer to store a bunch of vertices and > then the associated colors. > as far as i understand, i should then use the last parameter of the > usual gl[Vertex|Color]Pointer to pass the offset of the first element > inside the array. > for the vertices, it's 0, so i can pass None (the c functions expect a > void* parameter). > the problem is for non-zero offsets, e.g. for the colors in this case. > it seems that the python wrapper interprets the last parameter as an > array, and i have not found a way to pass an offset without > "dewrapping" the function, i.e. > > offset = 12 > glColorPointer.wrappedOperation(3, GL_FLOAT, 0, offset) # works > glColorPointer(3, GL_FLOAT, 0, any_thing_i_could_think_of(offset)) # > doesn't work > > i've tried several any_thing_i_could_think_of functions (casting to > c_void_p, etc.) with no luck. > any advice ? > I'm afraid I'm so accustomed to using the OpenGL.arrays.vbo.VBO wrapper that I haven't documented the base operation: ctypes.c_void_p( 12 ) should work as an array offset of 12 bytes, if it isn't, let me know and I'll dig into why it's not working for you (failing code would be helpful). The wrapper includes a VBOOffset type which basically is interpreted as an offset when using the wrapper (they're created with myVBO + byteOffset). HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |