[osg-users] Using Geometry with packed vertex arrays

Ravi Mathur ravidavi at utexas.edu
Fri Mar 24 21:39:42 PDT 2017


Hi all,

I have an array of floats that contains packed vertex data, provided by an external API, that I want to render. The data represents [position,normal,texcoord] for each vertex. The array layout is: 

[posX1,posY1,posZ1,nX1,nY1,nZ1,texS1,texT1,posX2,posY2,posZ2,nX2,nY2,nZ2,texS2,texT2,...]

Currently, I copy this array into separate osg Arrays (Vec3Array positions, Vec3Array normals, Vec2Array texCoords), then use the appropriate set*Array() in Geometry. This works just fine, but I'm wondering whether I really NEED to copy the source data. 

Is it possible to directly send the original float array and specify strides and offsets for the position/normal/tex data? In straight OpenGL I could send the float array as a VBO and call glVertexAttribPointer to specify the strides and offsets. I've looked in the osg examples and src, but don't see this being done anywhere. Whenever VBOs are used, the position/normal/texCoord data are specified as separate arrays.

Has anyone tackled the problem of passing a packed array as a VBO?

Thanks,
Ravi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70544#70544








More information about the osg-users mailing list