Hi Ken,
I've been able to do interleaved arrays inside my own Drawable pretty
well.  The biggest headaches actually came from trying to not
interfere with OSG's lazy OpenGL state setting.  Once I had that
figured out and set up all my vertex data in mVertData, all I had to
do to draw it was something like this:

void YourClass::drawImplementation(RenderInfo& renderinfo) const{
  State& state = *renderInfo.getState();

  // disable all array pointers and leave active client tex unit in proper state
  state.disableAllVertexArrays();
  state.setClientActiveTextureUnit(0);

  // then glInterleavedArrays enables the pointers it requires
  glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, (GLvoid*)mVertData);

  // draw it
  glDrawArrays(GL_QUADS, first * float_size, count * 4);

  // make sure OSG sets up its own state again
  state.dirtyAllVertexArrays();
}

--
Terry Welsh  /  mogumbo 'at' gmail.com
www.reallyslick.com  /  www.mogumbo.com


>
> Message: 15
> Date: Thu, 8 Jan 2009 10:27:48 -0500
> From: "Sewell, Kenneth R Civ USAF AFMC AFRL/RYZW"
>        <[email protected]>
> Subject: [osg-users] Interleaved vertex data and VBOs.
> To: <[email protected]>
> Message-ID:
>        
> <1d549ba2c0e341498f8d84ae7203dd1f04856...@vfohmlao13.enterprise.afmc.ds.af.mil>
>
> Content-Type: text/plain;       charset="us-ascii"
>
> I'm porting some OpenGL code that has the vertex position, normal, tex
> coord, ... interleaved in one large array.
>
> In OpenGL I could use one buffer:
> glBindBuffer( GL_ARRAY_BUFFER, bufferObject );
> glVertexPointer( 3, GL_FLOAT, sizeOfVertex, 0 );
> glNormalPointer( GL_FLOAT, sizeOfVertex, offsetToNormal );
>
> I'm struggling to figure out how to do it in OSG.  The only OSG examples
> I can find have the position data in one array, the normal data in
> another, ...  I've been looking through the source code, but I'm not
> having much luck.  Any pointers?  Thanks.
>
> Ken.
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to