Have added a #define USE_DEPRECATED_API to include/osg/Export, and
various osg header and source files to optional compile in deprecated parts of the OSG API. Have renamed osg::Transparency osg::BlendFunc to bring it in line with the rest of the OSG's StateAttribute classes which are named after their OpenGL counterparts. include/osg/Transparency still exists and is simply a typedef to BlendFunc and is enclosed in a #ifdef USE_DEPRECTATED_API block. The matrix methods in the osg::Transform class have been moved/replicated in a osg::MatrixTransform sublcass from osg::Transform. The old matrix functionality is still present in the osg::Transform class but is guard by #ifdef USG_DEPRECATED_API blocks. One should now think of osg::Transform as being a Transform Node base class. MatrixTransform has all the functionality of the original Transform class, so should be used instead.
This commit is contained in:
@@ -183,7 +183,7 @@ void set2dScene(osg::Group* rootNode)
|
||||
textState->setAttribute(textMaterial );
|
||||
textState->setAttribute(transp);
|
||||
|
||||
textState->setMode(GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
textState->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
textState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
geode->setStateSet( textState );
|
||||
|
||||
|
||||
@@ -340,9 +340,10 @@ void build_world(osg::Group *root)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
int main()
|
||||
int main( int /*argc*/, char **argv )
|
||||
{
|
||||
osgGLUT::Viewer viewer;
|
||||
viewer.setWindowTitle(argv[0]);
|
||||
|
||||
osg::Group *root = osgNew osg::Group;
|
||||
build_world(root);
|
||||
|
||||
@@ -119,8 +119,8 @@ int main( int argc, char **argv )
|
||||
stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE_ON);
|
||||
stateset->setAttributeAndModes(polyoffset,osg::StateAttribute::OVERRIDE_ON);
|
||||
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE_ON);
|
||||
stateset->setMode(GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE_OFF);
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE_ON);
|
||||
stateset->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE_OFF);
|
||||
|
||||
// osg::LineStipple* linestipple = new osg::LineStipple;
|
||||
// linestipple->setFactor(1);
|
||||
|
||||
@@ -77,17 +77,11 @@ void set2dScene(osg::Group* rootNode)
|
||||
osgText::Text::BOUNDINGBOX |
|
||||
osgText::Text::ALIGNMENT );
|
||||
text->setAlignment(gAlignment);
|
||||
text->setColor(TEXT_COL_2D);
|
||||
geode = osgNew osg::Geode();
|
||||
geode->setName("BitmapFont");
|
||||
geode->addDrawable( text );
|
||||
|
||||
textMaterial = osgNew osg::Material();
|
||||
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
|
||||
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
|
||||
textState = osgNew osg::StateSet();
|
||||
textState->setAttribute(textMaterial );
|
||||
geode->setStateSet( textState );
|
||||
|
||||
rootNode->addChild(geode);
|
||||
|
||||
xOffset+=90;
|
||||
@@ -105,24 +99,17 @@ void set2dScene(osg::Group* rootNode)
|
||||
osgText::Text::BOUNDINGBOX |
|
||||
osgText::Text::ALIGNMENT );
|
||||
text->setAlignment(gAlignment);
|
||||
text->setColor(TEXT_COL_2D);
|
||||
geode = osgNew osg::Geode();
|
||||
geode->setName("PixmapFont");
|
||||
geode->addDrawable( text );
|
||||
|
||||
textMaterial = osgNew osg::Material();
|
||||
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
|
||||
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_2D);
|
||||
// to get antiaA pixmapFonts we have to draw them with blending
|
||||
osg::Transparency *transp= osgNew osg::Transparency();
|
||||
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
|
||||
|
||||
textState = osgNew osg::StateSet();
|
||||
textState->setAttribute(textMaterial );
|
||||
textState->setAttribute(transp);
|
||||
textState->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
textState->setAttributeAndModes(transp,osg::StateAttribute::ON);
|
||||
textState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
|
||||
|
||||
@@ -145,22 +132,19 @@ void set2dScene(osg::Group* rootNode)
|
||||
osgText::Text::BOUNDINGBOX |
|
||||
osgText::Text::ALIGNMENT );
|
||||
text->setAlignment(gAlignment);
|
||||
text->setColor(TEXT_COL_2D);
|
||||
geode = osgNew osg::Geode();
|
||||
geode->setName("TextureFont");
|
||||
geode->addDrawable( text );
|
||||
|
||||
textMaterial = osgNew osg::Material();
|
||||
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
|
||||
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
|
||||
// to get antiaA pixmapFonts we have to draw them with blending
|
||||
transp= osgNew osg::Transparency();
|
||||
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
textState = osgNew osg::StateSet();
|
||||
textState->setAttribute(textMaterial );
|
||||
textState->setAttribute(transp);
|
||||
textState->setAttributeAndModes(transp,osg::StateAttribute::ON);
|
||||
|
||||
textState->setMode(GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
textState->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
textState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
geode->setStateSet( textState );
|
||||
|
||||
@@ -182,17 +166,11 @@ void set2dScene(osg::Group* rootNode)
|
||||
osgText::Text::BOUNDINGBOX |
|
||||
osgText::Text::ALIGNMENT );
|
||||
text->setAlignment(gAlignment);
|
||||
text->setColor(TEXT_COL_2D);
|
||||
geode = osgNew osg::Geode();
|
||||
geode->setName("PolygonFont");
|
||||
geode->addDrawable( text );
|
||||
|
||||
textMaterial = osgNew osg::Material();
|
||||
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
|
||||
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
|
||||
textState = osgNew osg::StateSet();
|
||||
textState->setAttribute(textMaterial );
|
||||
geode->setStateSet( textState );
|
||||
|
||||
rootNode->addChild(geode);
|
||||
|
||||
xOffset+=90;
|
||||
@@ -212,17 +190,11 @@ void set2dScene(osg::Group* rootNode)
|
||||
osgText::Text::BOUNDINGBOX |
|
||||
osgText::Text::ALIGNMENT );
|
||||
text->setAlignment(gAlignment);
|
||||
text->setColor(TEXT_COL_2D);
|
||||
geode = osgNew osg::Geode();
|
||||
geode->setName("OutlineFont");
|
||||
geode->addDrawable( text );
|
||||
|
||||
textMaterial = osgNew osg::Material();
|
||||
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
|
||||
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
|
||||
textState = osgNew osg::StateSet();
|
||||
textState->setAttribute(textMaterial );
|
||||
geode->setStateSet( textState );
|
||||
|
||||
rootNode->addChild(geode);
|
||||
|
||||
|
||||
@@ -337,7 +309,7 @@ void setScene(osg::Group* rootNode)
|
||||
textState->setAttribute(transp);
|
||||
|
||||
// textState->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
textState->setMode(GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
textState->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
textState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
geode->setStateSet( textState );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user