Files Classes Functions Hierarchy
00001 #include <textoverlay.h> 00002 00003 textoverlay::textoverlay 00004 ( 00005 doublec left_, 00006 doublec right_, 00007 doublec bottom_, 00008 doublec top_ 00009 ) 00010 : left(left_), right(right_), bottom(bottom_), 00011 top(top_), drawpre(true), drawpost(true) 00012 { 00013 init(); 00014 } 00015 00016 textoverlay::textoverlay() 00017 : left(-0.5), right(639.5), bottom(479.5), 00018 top(-1.0), drawpre(true), drawpost(true) 00019 { 00020 init(); 00021 } 00022 00023 void textoverlay::printstring 00024 ( 00025 void *font, 00026 string const & s 00027 ) const 00028 { 00029 //cout << "*" << s << "*" << endl; 00030 uint len = s.size(); 00031 for (uint i=0; i<len; ++i) 00032 glutBitmapCharacter(font,s[i]); 00033 } 00034 00035 void textoverlay::lightingdisable() 00036 { 00037 drawpre.push_back(new gobjglPushAttrib(GL_CURRENT_BIT)); 00038 drawpre.push_back(new gobjglPushAttrib(GL_LIGHTING)); 00039 00040 drawpre.push_back(new gobjglDisable(GL_LIGHTING)); 00041 00042 drawpost.push_front(new gobjglPopAttrib()); 00043 drawpost.push_front(new gobjglPopAttrib()); 00044 } 00045 00046 00047 void textoverlay::init() 00048 { 00049 drawpre.nuke(); 00050 drawpost.nuke(); 00051 00052 // assuming GL_MODELVIEW mode 00053 drawpre.push_back(new gobjglPushMatrix()); // save 00054 drawpre.push_back(new gobjglLoadIdentity()); // clear 00055 00056 drawpre.push_back(new gobjglMatrixMode(GL_PROJECTION)); 00057 drawpre.push_back(new gobjglPushMatrix()); // save 00058 drawpre.push_back(new gobjglLoadIdentity()); // clear 00059 00060 drawpre.push_back(new gobjgluOrtho2D(left,right,bottom,top)); 00061 drawpre.push_back(new gobjglMatrixMode(GL_MODELVIEW)); 00062 00063 00064 drawpost.push_back(new gobjglMatrixMode(GL_PROJECTION)); 00065 drawpost.push_back(new gobjglPopMatrix()); // restore 00066 drawpost.push_back(new gobjglMatrixMode(GL_MODELVIEW)); 00067 drawpost.push_back(new gobjglPopMatrix()); // restore 00068 } 00069
1.5.8