这就是我目前的代码。但是,对于我的生活,我无法让文本旋转。我需要使用 glutBitmapCharacter 以外的东西吗?
澄清一下,这只是一个 2D 程序
主文件
#include "bookshelf.h"
void Initialize()
{
glClearColor (1.0, 1.0, 1.0, 0.0 );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(0,799,799,0,0.0,1.0);
}
void main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
glutInitWindowSize( 800, 800 );
glutInitWindowPosition( 200, 50 );
glutCreateWindow("Bookshelf - Ankit Ahuja");
Initialize();
glutDisplayFunc(Bookshelf);
glutMainLoop();
}
书架.h
#include <GL/glut.h>
void Bookshelf()
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glColor3f( 0.0, 0.0, 0.0 );
glRasterPos2f(170,90);
glRotatef(0,0.0,0.0,0.0);
char text1[50]="Apple Recipe Book";
for(int i=0; i<50; i++) glutBitmapCharacter(GLUT_BITMAP_8_BY_13,text1[i]);
glRasterPos2f(190,110);
glRotatef(0,0.0,0.0,0.0);
char text2[50]="Banana Recipe Book";
for(int i=0; i<50; i++) glutBitmapCharacter(GLUT_BITMAP_8_BY_13,text2[i]);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}