Further work on getting osgText compiling.

This commit is contained in:
Robert Osfield
2001-10-23 22:28:41 +00:00
parent b90a734810
commit a4e26d447b
3 changed files with 253 additions and 232 deletions

View File

@@ -0,0 +1,21 @@
#!smake
include ../../../Make/makedefs
C++FILES = \
main.cpp
TARGET = ../../../bin/osgtext
TARGET_BIN_FILES = osgtext
#note, use this library list when using the Performer osgPlugin.
#LIBS = ${PFLIBS} -losgGLUT -losgUtil -losgDB -losg $(GLUTLIB) -lGLU -lGL -lm -lXmu -lX11 -lXi
#note, standard library list.
LIBS = -losgGLUT -losgText -losgUtil -losgDB -losg $(GLUTLIB) -lGLU -lGL -lm -lXmu -lX11 -lXi
C++FLAGS += -I../../../include -g
LDFLAGS += -L../../../lib
include ../../../Make/makerules

View File

@@ -26,7 +26,7 @@
#include <osgGLUT/Viewer> #include <osgGLUT/Viewer>
#include <GL/glut.h> #include <GL/glut.h>
#include <osgText/text.h> #include <osgText/Text>
#include <vector> #include <vector>
@@ -47,7 +47,7 @@ std::string ttfPath1("./fonts/verdana.ttf");
int gFontSize=18; int gFontSize=18;
int gFontSize1=24; int gFontSize1=24;
std::vector<osg::ref_ptr<osgText::Text > > gTextList; std::vector<osg::ref_ptr<osgText::Text > > gTextList;
osgText::Text::AlignmentType gAlignement=osgText::Text::AlignmentType::LEFT_BOTTOM; osgText::Text::AlignmentType gAlignement=osgText::Text::LEFT_BOTTOM;
void set2dScene(osg::Group* rootNode) void set2dScene(osg::Group* rootNode)
@@ -71,9 +71,9 @@ void set2dScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_BITMAP)); text->setText(std::string("2d ")+std::string(TEXT_BITMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("BitmapFont"); geode->setName("BitmapFont");
@@ -99,9 +99,9 @@ void set2dScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_PIXMAP)); text->setText(std::string("2d ")+std::string(TEXT_PIXMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("PixmapFont"); geode->setName("PixmapFont");
@@ -134,9 +134,9 @@ void set2dScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_TEXTURE)); text->setText(std::string("2d ")+std::string(TEXT_TEXTURE));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("TextureFont"); geode->setName("TextureFont");
@@ -171,9 +171,9 @@ void set2dScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string("2d ")+std::string("TEXT_POLYGON")); text->setText(std::string("2d ")+std::string("TEXT_POLYGON"));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("PolygonFont"); geode->setName("PolygonFont");
@@ -201,9 +201,9 @@ void set2dScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_OUTLINE)); text->setText(std::string("2d ")+std::string(TEXT_OUTLINE));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("OutlineFont"); geode->setName("OutlineFont");
@@ -239,9 +239,9 @@ void setScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string(TEXT_BITMAP)); text->setText(std::string(TEXT_BITMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("BitmapFont"); geode->setName("BitmapFont");
@@ -266,9 +266,9 @@ void setScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string(TEXT_PIXMAP)); text->setText(std::string(TEXT_PIXMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("PixmapFont"); geode->setName("PixmapFont");
@@ -300,9 +300,9 @@ void setScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string(TEXT_TEXTURE)); text->setText(std::string(TEXT_TEXTURE));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("TextureFont"); geode->setName("TextureFont");
@@ -337,9 +337,9 @@ void setScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string(TEXT_POLYGON)); text->setText(std::string(TEXT_POLYGON));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("PolygonFont"); geode->setName("PolygonFont");
@@ -366,9 +366,9 @@ void setScene(osg::Group* rootNode)
gTextList.push_back(text); gTextList.push_back(text);
text->setText(std::string(TEXT_OUTLINE)); text->setText(std::string(TEXT_OUTLINE));
text->setPosition(osg::Vec3(xOffset,yOffset,0)); text->setPosition(osg::Vec3(xOffset,yOffset,0));
text->setDrawMode( osgText::Text::DrawModeType::TEXT | text->setDrawMode( osgText::Text::TEXT |
osgText::Text::DrawModeType::BOUNDINGBOX | osgText::Text::BOUNDINGBOX |
osgText::Text::DrawModeType::ALIGNEMENT ); osgText::Text::ALIGNEMENT );
text->setAlignement(gAlignement); text->setAlignement(gAlignement);
geode = new osg::Geode(); geode = new osg::Geode();
geode->setName("OutlineFont"); geode->setName("OutlineFont");
@@ -471,30 +471,30 @@ protected:
{ // change DrawMode { // change DrawMode
std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin(); std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin();
for(;itr!=gTextList.end();itr++) for(;itr!=gTextList.end();itr++)
(*itr)->setDrawMode(osgText::Text::DrawModeType::TEXT ^ (*itr)->getDrawMode()); (*itr)->setDrawMode(osgText::Text::TEXT ^ (*itr)->getDrawMode());
} }
return; return;
case '2': case '2':
{ // change DrawMode { // change DrawMode
std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin(); std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin();
for(;itr!=gTextList.end();itr++) for(;itr!=gTextList.end();itr++)
(*itr)->setDrawMode(osgText::Text::DrawModeType::BOUNDINGBOX ^ (*itr)->getDrawMode()); (*itr)->setDrawMode(osgText::Text::BOUNDINGBOX ^ (*itr)->getDrawMode());
} }
return; return;
case '3': case '3':
{ // change DrawMode { // change DrawMode
std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin(); std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin();
for(;itr!=gTextList.end();itr++) for(;itr!=gTextList.end();itr++)
(*itr)->setDrawMode(osgText::Text::DrawModeType::ALIGNEMENT ^ (*itr)->getDrawMode()); (*itr)->setDrawMode(osgText::Text::ALIGNEMENT ^ (*itr)->getDrawMode());
} }
return; return;
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
case '4': case '4':
{ // change BoundingBoxType to GEOMETRY { // change BoundingBoxType to GEOMETRY
std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin(); std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin();
osgText::Text::BoundingBoxType type=(*itr)->getBoundingBox()==osgText::Text::BoundingBoxType::GLYPH ? osgText::Text::BoundingBoxType type=(*itr)->getBoundingBox()==osgText::Text::GLYPH ?
osgText::Text::BoundingBoxType::GEOMETRY : osgText::Text::GEOMETRY :
osgText::Text::BoundingBoxType::GLYPH; osgText::Text::GLYPH;
for(;itr!=gTextList.end();itr++) for(;itr!=gTextList.end();itr++)
(*itr)->setBoundingBox(type); (*itr)->setBoundingBox(type);
} }
@@ -503,8 +503,8 @@ protected:
case '5': case '5':
{ // change the textAlignement { // change the textAlignement
gAlignement=(osgText::Text::AlignmentType)((int)gAlignement+1); gAlignement=(osgText::Text::AlignmentType)((int)gAlignement+1);
if(gAlignement>osgText::Text::AlignmentType::RIGHT_BOTTOM) if(gAlignement>osgText::Text::RIGHT_BOTTOM)
gAlignement=osgText::Text::AlignmentType::LEFT_TOP; gAlignement=osgText::Text::LEFT_TOP;
std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin(); std::vector<osg::ref_ptr<osgText::Text> >::iterator itr=gTextList.begin();
for(;itr!=gTextList.end();itr++) for(;itr!=gTextList.end();itr++)

View File

@@ -24,10 +24,10 @@ C++FILES = \
Version.cpp Version.cpp
TARGET_BASENAME = osgGLUT TARGET_BASENAME = osgText
LIBS = -L../../lib -losgDB -losgUtil -losg $(GLUTLIB) -lGLU -lGL -lm LIBS = -L../../lib -lfreetype -losgDB -losgUtil -losg -lGLU -lGL -lm
LIB = ../../lib/lib$(TARGET_BASENAME).so LIB = ../../lib/lib$(TARGET_BASENAME).so
#LIB = ../../lib/lib$(TARGET_BASENAME).a #LIB = ../../lib/lib$(TARGET_BASENAME).a
@@ -38,7 +38,7 @@ TARGET_INCLUDE_FILES = \
osgText/Version\ osgText/Version\
osgText/Text osgText/Text
C++FLAGS += -I ../../include -I /usr/local/include/freetype2 -I /usr/local/include/freetype2/freetype C++FLAGS += -I ../../include -I /usr/local/include/freetype2
include ../../Make/makerules include ../../Make/makerules