void GLBox::paintGL() { // this method draws the scene into the OpenGL widget // usually you do not call this method directly, instead call updateGL(), which in turn calls paintGL() manageTexture(); glClear( GL_COLOR_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, m_texID); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glTexCoord2i(0, 0); glVertex2i(-m_winWidth/2, -m_winHeight/2); glTexCoord2i(1, 0); glVertex2i( m_winWidth/2, -m_winHeight/2); glTexCoord2i(1, 1); glVertex2i( m_winWidth/2, m_winHeight/2); glTexCoord2i(0, 1); glVertex2i(-m_winWidth/2, m_winHeight/2); glEnd(); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); // perform all output operations glFlush(); }
void GLBox::paintGL() { // this method draws the scene into the OpenGL widget // usually you do not call this method directly, instead call updateGL(), which in turn calls paintGL() clearImage(Color(1.0, 1.0, 1.0)); //----- Clock bresenhamCircle(m_clock.getCenter(), m_clock.getRadius()); //draw Hour Pointer bresenhamLine(m_clock.getCenter(), Mat3d::getTranslationmatix(m_clock.getCenter()) * m_clock.getHours(), Color(1,0,0)); //draw Minute Pointer bresenhamLine(m_clock.getCenter(), Mat3d::getTranslationmatix(m_clock.getCenter()) * m_clock.getMinutes(), Color(0,0,1)); //draw Seconds Pointer bresenhamLine(m_clock.getCenter(), Mat3d::getTranslationmatix(m_clock.getCenter()) * m_clock.getSeconds(), Color(0,1,0)); //------------- manageTexture(); glClear( GL_COLOR_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, m_texID); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glTexCoord2i(0, 0); glVertex2i(-m_winWidth/2, -m_winHeight/2); glTexCoord2i(1, 0); glVertex2i( m_winWidth/2, -m_winHeight/2); glTexCoord2i(1, 1); glVertex2i( m_winWidth/2, m_winHeight/2); glTexCoord2i(0, 1); glVertex2i(-m_winWidth/2, m_winHeight/2); glEnd(); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); // perform all output operations glFlush(); }