QT5使用OpenGL的错误

(1)gluPerspective没有定义
例如:
gluPerspective( 45.0, (GLfloat)width/(GLfloat)height, 0.1,100.0 );

转换为:
GLfloat zNear = 0.1;
GLfloat zFar = 100.0;
GLfloat aspect = (GLfloat)width/(GLfloat)height;
GLfloat fH = tan(GLfloat(90.0/360.0*3.14159))*zNear;
GLfloat fW = fH * aspect;

glFrustum(-fW, fW, -fH, fH, zNear, zFar);


(2)error: undefined reference to `_imp___ZN9QGLWidgetC2EP7QWidgetPKS_6QFlagsIN2


QT += opengl

(3)error: undefined reference to `_imp__glShadeModel@4'

LIBS += -lOpengl32
LIBS += -lglu32
LIBS += -lglut

猜你喜欢

转载自blog.csdn.net/taiyang1987912/article/details/80508112
Qt5