Re: [osg-news] strange crash
Brought to you by:
robertosfield
|
From: Robert O. <ro...@op...> - 2003-03-20 11:58:00
|
Hi Gabor,
> My app crash randomly with the new osgText implementation.
> The app looks like this:
>
> start:
> =09init sceneview
> =09app things
> =09if ( restart )
> =09=09term sceneview
> =09=09goto start
>
> The app crash only after 1-more restart, there is no valid call stack,
> just an address and two nvoglnt.dll line (under windoz).
> I can't found the real bug, but the following lines solve the problem:
>
> void Text::drawImplementation( ... )
> ...
> if (_drawMode & TEXT)
> {
>
> state.disableAllVertexArrays();
> for(TextureGlyphQuadMap::const_iterator
> titr=3D_textureGlyphQuadMap.begin(); titr!=3D_textureGlyphQuadMap.end()=
;
> ++titr)
> {
> state.apply(titr->first.get());
> const GlyphQuads& glyphquad =3D titr->second;
> state.setVertexPointer( 2, GL_FLOAT, 0,
> &(glyphquad._coords.front())); state.setTexCoordPointer( 0, 2, GL_FLOAT=
, 0,
> &(glyphquad._texcoords.front()));
> glDrawArrays(GL_QUADS,0,glyphquad._coords.size());
>
> // !!!!!!!!!!!!!!!!!!!!!!!!!!!!
> // ugly patch:
> state.dirtyTexCoordPointer(0);
> glDisableClientState(GL_TEXTURE_COORD_ARRAY);
> // !!!!!!!!!!!!!!!!!!!!!!!!!!!!
> }
> }
> ...
>
>
> I don't know what is wrong, but somebody may find the real bug from thi=
s...
I suspect it isn't Text which is crashing but some other OpenGL drawing c=
ode=20
which follows on after Text is drawn, the OpenGL code not disabling the t=
ex=20
coords or setting its value as it should do. Text already does this itse=
lf -=20
see the state.disableAllVertexArrays() call in the above code. Perhaps t=
his=20
needs to be added elsewhere in the OSG or your own code.
Robert,
|