Hi, I was struggling with this as well http://forum.openscenegraph.org/viewtopic.php?t=13199 .... Try setting lighting OFF on the quad as well
Nick On Wed, Jul 16, 2014 at 5:40 PM, Bram Vaessen <[email protected]> wrote: > Hi, > > I'm working on my own simple HUD/GUI system, and my idea was to use a > seperate orthogonal camera for that, which is attached to the root node, > and is set to post-render. It does to work so far, except that the quad > that I'm drawing on screen is about 4 times more dark than it should be. > For example when I try to make it white, it becomes color (63,63,63). > I'v set lighting to off, use no shader, tried setting fog off, I tried > setting blending off (but that should be turned on at some point > anyway...), but whatever I do it still is much darker than it should be. > > Any idea what could be the cause of this? > > This is how I create the camera: > > > Code: > osg::ref_ptr<osg::Camera> camera = new osg::Camera(); > camera->setViewport(new osg::Viewport(0,0,width,height)); > camera->setClearMask(GL_DEPTH_BUFFER_BIT); > //camera->setClearColor(osg::Vec4(0,0,0,0)); > camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > camera->setRenderOrder(osg::Camera::POST_RENDER,0); > camera->setProjectionMatrixAsOrtho2D(0,width,height,0); > camera->getOrCreateStateSet()->setMode(GL_BLEND, > osg::StateAttribute::OFF); //blend > camera->getOrCreateStateSet()->setMode(GL_LIGHTING, > osg::StateAttribute::OFF); > > > > > and this the quad: > > > Code: > rectGeom = new osg::Geometry(); > rectGeom->setSupportsDisplayList(false); > osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array; > osg::ref_ptr<osg::Vec2Array> texcoords = new osg::Vec2Array; > vertices->push_back(osg::Vec3d(0,0,0)); > texcoords->push_back(osg::Vec2(0,0)); > vertices->push_back(osg::Vec3d(width,0,0)); > texcoords->push_back(osg::Vec2(width,0)); > vertices->push_back(osg::Vec3d(width,height,0)); > texcoords->push_back(osg::Vec2(width,height)); > vertices->push_back(osg::Vec3d(0,height,0)); > texcoords->push_back(osg::Vec2(0,height)); > rectGeom->setVertexArray(vertices); > osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array; > colors->push_back(osg::Vec4(0,0,1,1)); > colors->push_back(osg::Vec4(0,1,0,1)); > colors->push_back(osg::Vec4(1,0,0,1)); > colors->push_back(osg::Vec4(1,1,1,1)); > rectGeom->setColorArray(colors); > rectGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); > //rectGeom->setColorBinding(osg::Geometry::BIND_OVERALL); > rectGeom->addPrimitiveSet(new > osg::DrawArrays(osg::PrimitiveSet::QUADS,0,vertices->size())); > > > > Any ideas? > > Thank you! > > Cheers, > Bram > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=60300#60300 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

