本机所有操作,代码均在ubuntu dapper下验证通过。
安装
apt-get install freeglut3-dev
它会装上依赖的包的。
测试代码
当然是写个程序测试了,我只是把“Computer Graphics Using
OpenGL”的第一个完整程序稍微改了改。另外发现个blog的问题-把<GL/glut.h>给替换没了。
#include “GL/gl.h” // OpenGL itself.
#include “GL/glut.h” // GLUT support library.
void DrawText(GLint x, GLint y, char* s, GLfloat r, GLfloat g,
GLfloat b)
{
int lines;
char* p;
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, glutGet(GLUT_WINDOW_WIDTH),
0.0, glutGet(GLUT_WINDOW_HEIGHT), -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glColor3f(r,g,b);
glRasterPos2i(x, y);
for(p = s, lines = 0; *p; p++) {
if (*p == '\n') {