Hello,
I am having a problem with display text on my GLUT screen. creating the font is just fine, thanks to nexusone, but the problem comes in when I display it and nothing shows up.
Code for text:
void Text( int x, int y, char *st ) {
int l, i;
l=strlen( st );
glRasterPos3i( x, y, 1);
for( i=0; i < l; i++) {
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24, st[i] );
}
}
Thanks to nexusone!!!
Code for displaying:
void display( void ) {
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glColor3f( 1.0, 1.0, 1.0 );
Text( 1, 1, “GLUT Screen” );
glBegin( GL_POLYGON );
glTexCoord2f( 0.0f, 0.0f ); glVertex3f( -2.5f, -0.8f, 0.5f );
glTexCoord2f( 1.0f, 0.0f ); glVertex3f( 2.5f, -0.8f, 0.5f );
glTexCoord2f( 1.0f, 1.0f ); glVertex3f( 2.5f, 0.8f, 0.5f );
glTexCoord2f( 0.0f, 1.0f ); glVertex3f( -2.5f, 0.8f, 0.5f );
glEnd();
glPopMatrix();
glutSwapBuffers();
}
Code for Cameras:
void reshape( int w, int h ) {
if( h == 0 )
h = 1;
float ratio = 1.0 * w / h;
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glViewport( 0, 0, w, h );
gluPerspective( 25, ratio, 1, 1000 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt( 0.0, 0.0, 5.0, 0.0, 0.0, -1.0, 0.0f, 1.0f, 0.0f );
}
- VC6-OGL
[This message has been edited by VC6-OGL (edited 12-16-2002).]
[This message has been edited by VC6-OGL (edited 12-16-2002).]