Hi Erik,

Do you mean glowing like non-lit but selfillumination? Then you're maybe after the setEmission property. If you want a glow like bloom-effect, then you'll need some image postprocessing or texture tricks. Maybe you can send some picture which resembles what you are trying to achieve. BTW: your geometry doesn't have any normals, so lighting will be wrong in any case.


Cheers
Sebastian
Hello everyone!

I'm generating a sphere geode and I'd like to add a glowing effect in any 
variable color. I've only found one other similar topic on these forums but 
there was no answer. I imagine this must be possible, I just don't know how to 
do it. I've posted my code that creates the geode.

Any and all help is very much appreciated!


Code:

// The center of my sphere
osg::Vec3 tSphereCenter(0.0f, 0.0f, 0.0f);

// Create the geode
osg::ref_ptr < osg::Geode > pGeode = new osg::Geode;

// Create the geometry
osg::ref_ptr < osg::Geometry > pGeometry = new osg::Geometry;

// The vertex array that defines the shape of the sphere
osg::ref_ptr < osg::Vec3Array > pVertexArray = new osg::Vec3Array;

//
// Add vertices to pVertexArray using an icosahedron approach...
// How this is done is not relevant to this question...
//

// Set this as the geometry's vertex array
pGeometry->setVertexArray(pVertexArray);

// Set the primitive set
osg::ref_ptr < osg::DrawArrays > pDrawArrays = new 
osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, static_cast < GLsizei 
>(pVertexArray->size()));
pGeometry->addPrimitiveSet(pDrawArrays);

// Get the state set
osg::ref_ptr < osg::StateSet > pStateSet = pGeometry->getOrCreateStateSet();

// Create the material
osg::ref_ptr < osg::Material > pMaterial = new osg::Material;

// Set the sphere color to red
pMaterial->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0f, 0.0f, 
0.0f, 1.0f));

// Make the sphere shiny
pMaterial->setShininess(osg::Material::FRONT_AND_BACK, 128.0f);

// Set the material on the geometry's state set
pStateSet->setAttribute(pMaterial);

// Finish up with the geometry
pStateSet->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
pGeometry->setStateSet(pStateSet);

// Add this geometry to the geode
pGeode->addDrawable(pGeometry);

// Ensure the geode is visible
pGeode->setNodeMask(0xffffffff);

// Smooth out the material
osgUtil::SmoothingVisitor sv;
pGeode->accept(sv);

// Add the geode to the scene
pSceneGroup->addChild(pGeode);




Thank you very much!

Cheers,
Erik[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65690#65690





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to