1#ifndef __openglhelper__
2#define __openglhelper__
17#ifndef QWT3D_NOT_FOR_DOXYGEN
37 stateval_ = glIsEnabled(what);
52 void turnOn(
bool persist =
false)
59 void turnOff(
bool persist =
false)
72inline const GLubyte *gl_error()
75 const GLubyte *err = 0;
77 if ((errcode = glGetError()) != GL_NO_ERROR) {
78 err = gluErrorString(errcode);
84inline void SaveGlDeleteLists(GLuint &lstidx, GLsizei range)
87 glDeleteLists(lstidx, range);
102inline void getMatrices(GLdouble *modelMatrix, GLdouble *projMatrix, GLint *viewport)
104 glGetIntegerv(GL_VIEWPORT, viewport);
105 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
106 glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
120inline bool ViewPort2World(
double &objx,
double &objy,
double &objz,
double winx,
double winy,
123 GLdouble modelMatrix[16];
124 GLdouble projMatrix[16];
127 getMatrices(modelMatrix, projMatrix, viewport);
129 gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, &objx, &objy, &objz);
131 return (res == GL_FALSE) ? false :
true;
145inline bool World2ViewPort(
double &winx,
double &winy,
double &winz,
double objx,
double objy,
148 GLdouble modelMatrix[16];
149 GLdouble projMatrix[16];
152 getMatrices(modelMatrix, projMatrix, viewport);
153 int res = gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, &winx, &winy, &winz);
155 return (res == GL_FALSE) ? false :
true;
管理 OpenGL 状态启用/禁用的辅助类
Definition qwt3d_openglhelper.h:32