Hi Otto,

The OSG uses lazy state updating to prevent unnecessary calls being
made to OpenGL, however, it does mean that if you change OpenGL state
yourself without telling the OSG about it then it can get out of sync
and cause problems. I would recommend using the osg::State methods for
setting the vertex array pointers and enabling them, this way you can
keep everything in sync and avoid making unnecessary OpenGL calls.

Robert.

On Tue, Mar 9, 2010 at 3:07 PM, Otto Cologne <schur...@gmx.de> wrote:
> Hi,
>
> i'm trying to use vertex arrays in my own drawable. For some reason it 
> crashes in the glDrawArrays call. The draw implementation is some code that 
> works in another program of mine which uses pure opengl.
>
>
> Code:
>
>    glEnableClientState( GL_VERTEX_ARRAY );
>    glEnableClientState( GL_COLOR_ARRAY );
>
>    glVertexPointer( 3, GL_FLOAT, 0, &(*verts)[0] );
>    glColorPointer( 3, GL_FLOAT, 0, &(*colors)[0] );
>
>    for ( size_t i = 0; i < active->size(); ++i )
>    {
>        if ( (*active)[i] )
>        {
>            glDrawArrays( GL_LINE_STRIP, (*startIndexes)[i] * 3, 
> (*pointsPerLine)[i] );
>        }
>    }
>    glDisableClientState( GL_VERTEX_ARRAY );
>    glDisableClientState( GL_COLOR_ARRAY );
>
>
>
>
> In the constructor of the drawable there is a setSupportsDisplayList( false );
>
> For the opengl part this looks correct, the only thing i could think of now 
> is that it's not ok to do stuff like glEnableClientState directly but have to 
> use some osg state object. Any hints on how to do it correctly will be 
> greatly appreciated.
>
>
>
> Thank you!
>
> Cheers,
> Otto
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=25393#25393
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to