Hi Aurelien, Sorry for the slow turnaround to getting to this submissions. I've just done a review and came away wondering whether you could just use the StatsHandler::getCamera() to modify the state used for the stats subgraph? This wouldn't require any modifications to StatsHandler.
Thoughts? Robert. On 20 February 2013 22:30, Aurelien Albert <[email protected]> wrote: > Hi, > > When osg::State is configured to use VertexAttributesAliasing, the > StatsHandler is not rendered properly. > I added a "decorator" node into the StatsHandler subgraph to allow developper > to bind specific StateAttribute for Stats rendering. > > To reproduce the problem, simply add this in the osgViewer example, run it > and display statistics (the "s" key) : > > > Code: > > viewer.getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true); > > viewer.getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true); > > > > > In my code, I use this configuration for proper rendering (but this may be > application dependant) : > > > Code: > > pStatsHandler->getDecorator()->getOrCreateStateSet()->setAttributeAndModes(pStatsProgram); > > pStatsHandler->getDecorator()->getOrCreateStateSet()->setTextureAttributeAndModes(0, > pStatsDefaultTexture); > pStatsHandler->getDecorator()->getOrCreateStateSet()->addUniform(new > osg::Uniform("osg_TextTexture", (int) 0)); > > > > with : > > - pStatsDefaultTexture : a 32x32 texture with all pixel set to (255, 255, > 255, 255) > > - pStatsProgram vertex shader : > > > Code: > attribute vec4 osg_Vertex; > attribute vec4 osg_Color; > attribute vec4 osg_MultiTexCoord0; > uniform mat4 osg_ModelViewProjectionMatrix; > > varying vec4 color; > varying vec2 textureCoords; > > void main() > { > color = osg_Color; > textureCoords = osg_MultiTexCoord0.xy; > gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex; > } > > > > - pStatsProgram fragment shader : > > > Code: > uniform sampler2D osg_TextTexture; > > varying vec4 color; > varying vec2 textureCoords; > > void main() > { > vec4 textColor = vec4(1.0, 1.0, 1.0, texture2D(osg_TextTexture, > textureCoords).a); > gl_FragColor = color * textColor; > } > > > > > Cheers, > Aurelien > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=52796#52796 > > > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
