22 #include <QMessageBox>
24 QtGLContext::QtGLContext(QWidget* parent ,
const QGLWidget* sharedWidget , Qt::WFlags f ) : QGLWidget(parent, sharedWidget, f), m_imgP(0), m_mousePressed(false)
45 glColor3f(0.0,0.0,0.0);
46 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
49 glShadeModel(GL_FLAT);
51 glMatrixMode(GL_PROJECTION);
53 glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
54 glMatrixMode(GL_MODELVIEW);
63 glColor3f(1.0,1.0,1.0);
64 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
69 glDisable(GL_DEPTH_TEST);
71 glEnable(GL_DEPTH_TEST);
75 glBegin(GL_LINE_STRIP);
88 glEnable(GL_TEXTURE_2D);
111 glTexCoord2f(ulX, ulY); glVertex2f( -1, -1 );
112 glTexCoord2f(ulX, lrY); glVertex2f( -1, 1 );
113 glTexCoord2f(lrX, lrY); glVertex2f( 1, 1 );
114 glTexCoord2f(lrX, ulY); glVertex2f( 1, -1 );
118 glTexCoord2f(ulX, ulY); glVertex2f( -1, 1 );
119 glTexCoord2f(ulX, lrY); glVertex2f( -1, -1 );
120 glTexCoord2f(lrX, lrY); glVertex2f( 1, -1 );
121 glTexCoord2f(lrX, ulY); glVertex2f( 1, 1 );
127 glTexCoord2f(ulX, ulY); glVertex2f( 1, 1 );
128 glTexCoord2f(ulX, lrY); glVertex2f( 1, -1 );
129 glTexCoord2f(lrX, lrY); glVertex2f( -1, -1 );
130 glTexCoord2f(lrX, ulY); glVertex2f( -1, 1 );
134 glTexCoord2f(ulX, ulY); glVertex2f( -1, 1 );
135 glTexCoord2f(ulX, lrY); glVertex2f( -1, -1 );
136 glTexCoord2f(lrX, lrY); glVertex2f( 1, -1 );
137 glTexCoord2f(lrX, ulY); glVertex2f( 1, 1 );
141 glDisable(GL_TEXTURE_2D);
143 glTranslatef(-1.0,1.0,0);
150 unsigned int candidate = n;
152 while((candidate & (candidate - 1)) != 0) {
233 glViewport(0, 0, (GLsizei) w, (GLsizei) h);
255 glEnable(GL_TEXTURE_2D);
265 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
268 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
269 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
270 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
271 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
279 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
293 glDisable(GL_TEXTURE_2D);
297 glDisable(GL_TEXTURE_2D);
305 if (state == Qt::Checked)
318 static bool firstInit =
true;