[osg-users] Using Geometry with packed vertex arrays

Julien Valentin julienvalentin51 at gmail.com
Mon Mar 27 07:01:53 PDT 2017


Hi
I think you're using "packed" instead of "interleaved"..
interleaved arrays aren't support by osg. You'll have to create your Drawable::DrawCallback (and perhaps your own Drawable subclass) in order to do it.

Cheers


ravidavi wrote:
> 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=70562#70562








More information about the osg-users mailing list