Re: [PyOpenGL-Users] gl*Pointer() VBO offsets
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2010-01-15 02:30:40
|
Alejandro Segovia wrote: > Hi > > I've been working with VBO's to speed up my rendering time. I have an > array loaded with vertex data up to the middle and from there to the > end loaded with color data, but I'm having trouble setting the > appropriate offset in the glColorPointer() call. > > I've tried several approaches but they either raise an exception or > draw nothing. The only thing that seems to work is using None (which > automatically gets converted to NULL). > This will be because it was creating a 1-element array of integers (the offset) and then attempting to draw from it (duh). > Does anyone know what would the correct idiom be for converting from > an int into the offset "pointer" needed by PyOpenGL? > You need a ctypes.c_void_p( offset ), or if you're using OpenGL.arrays.vbo.VBO, you can just pass (your_vbo + offset) which creates an object whose array-value is ctypes.c_void_p( offset ). There was a bug in a 3.0.0 release (I believe a beta) that prevented interpreting the c_void_p( offset ) correctly. If it doesn't work, you may need to update to a 3.0.1 beta. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |