-3
以下是代碼我從一個教程了:無法設置的OpenGL
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glcorearb.h>
#include <GL/glext.h>
#include <GL/gl_mangle.h>
#include <GL/glu_mangle.h>
#include <GL/GLwDrawA.h>
#include <GL/GLwDrawAP.h>
#include <GL/glxext.h>
#include <GL/glx.h>
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(1, 0, 0); glVertex3f(-0.6, -0.75, 0.5);
glColor3f(0, 1, 0); glVertex3f(0.6, -0.75, 0);
glColor3f(0, 0, 1); glVertex3f(0, 0.75, 0);
glEnd();
glFlush();
}
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(80, 80);
glutInitWindowSize(400, 300);
glutCreateWindow("A Simple Triangle");
glutDisplayFunc(display);
glutMainLoop();
}
我包括在/ usr/include中/ GL發現一切。我使用RHEL 6
我收到以下錯誤:
In function ‘void display()’:
‘mglClear’ was not declared in this scope
‘mglBegin’ was not declared in this scope
‘mglColor3f’ was not declared in this scope
‘mglVertex3f’ was not declared in this scope
‘mglEnd’ was not declared in this scope
‘mglFlush’ was not declared in this scope
‘int main(int, char**)’:
test.cpp:25: error: ‘glutInit’ was not declared in this scope
test.cpp:26: error: ‘GLUT_SINGLE’ was not declared in this scope
test.cpp:26: error: ‘GLUT_RGB’ was not declared in this scope
test.cpp:26: error: ‘glutInitDisplayMode’ was not declared in this scope
test.cpp:28: error: ‘glutInitWindowPosition’ was not declared in this scope
test.cpp:29: error: ‘glutInitWindowSize’ was not declared in this scope
test.cpp:30: error: ‘glutCreateWindow’ was not declared in this scope
test.cpp:32: error: ‘glutDisplayFunc’ was not declared in this scope
test.cpp:34: error: ‘glutMainLoop’ was not declared in this scope
這是否意味着的東西是正確下載或我錯了,包括文件?
我沒有這個文件,不幸的是...... – user8333141
那麼,你如何期望使用'glut'的家族函數呢?我建議你安裝這個庫。 – Amadeus