/usr/include/qwtplot3d/qwt3d_openglhelper.h is in libqwtplot3d-qt5-dev 0.2.7+svn191-10.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | #ifndef __openglhelper_2003_06_06_15_49__
#define __openglhelper_2003_06_06_15_49__
#include "qglobal.h"
#if QT_VERSION < 0x040000
#include <qgl.h>
#else
#include <QtOpenGL/qgl.h>
#endif
#include <GL/glu.h>
namespace Qwt3D
{
#ifndef QWT3D_NOT_FOR_DOXYGEN
class GLStateBewarer
{
public:
GLStateBewarer(GLenum what, bool on, bool persist=false)
{
state_ = what;
stateval_ = glIsEnabled(what);
if (on)
turnOn(persist);
else
turnOff(persist);
}
~GLStateBewarer()
{
if (stateval_)
glEnable(state_);
else
glDisable(state_);
}
void turnOn(bool persist = false)
{
glEnable(state_);
if (persist)
stateval_ = true;
}
void turnOff(bool persist = false)
{
glDisable(state_);
if (persist)
stateval_ = false;
}
private:
GLenum state_;
bool stateval_;
};
inline const GLubyte* gl_error()
{
GLenum errcode;
const GLubyte* err = 0;
if ((errcode = glGetError()) != GL_NO_ERROR)
{
err = gluErrorString(errcode);
}
return err;
}
inline void SaveGlDeleteLists(GLuint& lstidx, GLsizei range)
{
if (glIsList(lstidx))
glDeleteLists(lstidx, range);
lstidx = 0;
}
//! get OpenGL transformation matrices
/**
Don't rely on (use) this in display lists !
\param modelMatrix should be a GLdouble[16]
\param projMatrix should be a GLdouble[16]
\param viewport should be a GLint[4]
*/
inline void getMatrices(GLdouble* modelMatrix, GLdouble* projMatrix, GLint* viewport)
{
glGetIntegerv(GL_VIEWPORT, viewport);
glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
}
//! simplified glut routine (glUnProject): windows coordinates_p --> object coordinates_p
/**
Don't rely on (use) this in display lists !
*/
inline bool ViewPort2World(double& objx, double& objy, double& objz, double winx, double winy, double winz)
{
GLdouble modelMatrix[16];
GLdouble projMatrix[16];
GLint viewport[4];
getMatrices(modelMatrix, projMatrix, viewport);
int res = gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, &objx, &objy, &objz);
return (res == GL_FALSE) ? false : true;
}
//! simplified glut routine (glProject): object coordinates_p --> windows coordinates_p
/**
Don't rely on (use) this in display lists !
*/
inline bool World2ViewPort(double& winx, double& winy, double& winz, double objx, double objy, double objz )
{
GLdouble modelMatrix[16];
GLdouble projMatrix[16];
GLint viewport[4];
getMatrices(modelMatrix, projMatrix, viewport);
int res = gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, &winx, &winy, &winz);
return (res == GL_FALSE) ? false : true;
}
#endif // QWT3D_NOT_FOR_DOXYGEN
} // ns
#endif
|