Hi,
New to OSG and kind of stuck ATM...
Trying to convert some earlier openGL code to OSG. here is the code snippet
// move to center of standby gauge
glTranslated(35,35,0);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
// Builds the sphere and sets attitude
glBindTexture(GL_TEXTURE_2D, num_adi);
glColor4f(0.535f,0.535f,0.535f,0.70f);
glPushMatrix();
glRotatef(pData->Pitch, 1, 0, 0 );
glRotated(pData->Bank, 0, 0, 1);
glRotated(-pData->Mag_Heading, 0, 1, 0);
glRotatef( 90.0, 1, 0, 0);
gluSphere(qADI, /* radius */ 27.0, /* slices */ 20, /* stacks */ 20);
// glCallList(theADI);
glPopMatrix();
// Adds the mask
glBindTexture(GL_TEXTURE_2D, num_mask);
glColor4f(0.05f,0.05f,0.05f,0.65f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex2f(-28.0, -28.0);
glTexCoord2f(0.0, 1.0); glVertex2f(-28.0, 28.0 );
glTexCoord2f(1.0, 1.0); glVertex2f(28.0, 28.0);
glTexCoord2f(1.0, 0.0); glVertex2f(28.0, -28.0);
glEnd();
glDisable(GL_TEXTURE_2D);
...
Have looked at example programs, (osgplanets, textures, etc)tutorials, other
sample programs and cannot get it working,
Thought this would work (the vertices were defined a priori...
// set up the textures.
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
// set up the textures.
osg::Texture2D* edge_mask = new osg::Texture2D;
edge_mask->setImage(mask);
// new we need to add the texture to the Drawable, we do so by creating a
// StateSet to contain the Texture2D StateAttribute.
osg::StateSet* stateset = new osg::StateSet;
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
stateset->setTextureAttributeAndModes(0, edge_mask,
osg::StateAttribute::ON);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
it did not. Also trying to find the doc to explain how to select the specific
blend function. Also tried the TexEnvCombine class and methods, but that was a
total zilch. Unfortumately, the documentation is a little light or I'm looking
in all the wrong places. Any tips, suggestions, code snippets would be
apprciated.
Thank you!
Cheers,
John
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34178#34178
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org