[PyOpenGL-Users] constructing a VBO containing mixture of floats, ubytes, etc
Brought to you by:
mcfletch
From: Jonathan H. <ta...@ta...> - 2011-02-03 11:49:59
|
Hey, I am using vbo.VBO, constructed using a single array of (position, color, normal) - all floats. This looks like: self.vbo = vbo.VBO( array( list( list(chain(v, c, n)) for v, c, n in zip(verts, colors, normals) ), 'f' ), usage='GL_STATIC_DRAW' ) where verts, colors, normals are each generator expressions containing named tuples of (x, y, z) or (r, g, b), etc. My problem is that I want to try out converting the colors to unsigned bytes instead of floats. When I was using vertex arrays instead of VBOs, using unsigned bytes gave me something like 25% better framerates on my hardware (2004 era laptop with ATI), purely from increased rendering speeds. Does it sound likely that I'll see this sort of improvement on other hardware too? Or should I just stick with using colors as floats throughout? If I do go ahead, I'm not certain how to construct the vbo containing mixed types like this. Is there anything in OpenGL.arrays that might help, or do I need to brush up on my ctypes-fu to construct an array of structs manually? I'm happy that I do understand how to assign the vertex attribute pointers once the vbo is constructed. Jonathan -- Jonathan Hartley Made of meat. http://tartley.com ta...@ta... +44 7737 062 225 twitter/skype: tartley |