void OGLFrame::paintGL_R(GLenum mode, int x, int y)
{
GLint vp[4];
bool select;
glViewport(_vp[0], _vp[1], _vp[2], _vp[3]);
if(mode != GL_SELECT)
{
select = false;
glRenderMode(GL_RENDER);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
}
else
{
select = true;
glGetIntegerv(GL_VIEWPORT, vp);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix((GLdouble) x, (GLdouble) y, 5.0, 5.0, vp);
}
gluPerspective(_fovy, _aspect, 0.01, 2*EXT);
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
this->setCamera();
_ph->drawObjects(select);
this->drawBackGround();
glColor4f(1.0, 0.0, 0.0, 1.0);
this->renderText(100, 100, "Hola");
// glMatrixMode(GL_PROJECTION);
// glPushMatrix();
// glLoadIdentity();
// glMatrixMode(GL_MODELVIEW);
// glPushMatrix();
// glLoadIdentity();
// renderText(100, 100, "Hola");
// glMatrixMode(GL_MODELVIEW);
// glPopMatrix();
// glMatrixMode(GL_PROJECTION);
// glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glFlush();
glFinish();
}
void OGLFrame::paintGL_R(GLenum mode, int x, int y)
{
GLint vp[4];
bool select;
glViewport(_vp[0], _vp[1], _vp[2], _vp[3]);
if(mode != GL_SELECT)
{
select = false;
glRenderMode(GL_RENDER);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
}
else
{
select = true;
glGetIntegerv(GL_VIEWPORT, vp);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix((GLdouble) x, (GLdouble) y, 5.0, 5.0, vp);
}
gluPerspective(_fovy, _aspect, 0.01, 2*EXT);
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
this->setCamera();
_ph->drawObjects(select);
this->drawBackGround();
glColor4f(1.0, 0.0, 0.0, 1.0);
this->renderText(100, 100, "Hola");
// glMatrixMode(GL_PROJECTION);
// glPushMatrix();
// glLoadIdentity();
// glMatrixMode(GL_MODELVIEW);
// glPushMatrix();
// glLoadIdentity();
// renderText(100, 100, "Hola");
// glMatrixMode(GL_MODELVIEW);
// glPopMatrix();
// glMatrixMode(GL_PROJECTION);
// glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glFlush();
glFinish();
}
To copy to clipboard, switch view to plain text mode
Bookmarks