static void CALLBACK Paint(void) { glViewport(0,0,windW,windH); glDisable(GL_SCISSOR_TEST); glPushAttrib(GL_COLOR_BUFFER_BIT); glColorMask(1,1,1,1); glIndexMask((GLuint)~0); glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT); glPopAttrib(); if(mode1)glShadeModel(GL_SMOOTH); else glShadeModel(GL_FLAT); if(mode2)glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); else glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); Viewport(0,0); Point(); Viewport(0,1); Lines(); Viewport(0,2); LineStrip(); Viewport(0,3); LineLoop(); Viewport(1,0); Bitmap(); Viewport(1,1); TriangleFan(); Viewport(1,2); Triangles(); Viewport(1,3); TriangleStrip(); Viewport(2,0); Rect(); Viewport(2,1); xPolygon(); Viewport(2,2); Quads(); Viewport(2,3); QuadStrip(); glFlush(); if(doubleBuffer)auxSwapBuffers(); }
/* * Function in charge of refreshing the display of the window */ void display() { glClear(GL_COLOR_BUFFER_BIT); // Clears the display write(); #if USE_DRAW_V2 switch(currentAlgorithm) { case GRAHAM_SCAN: drawLineStrip(*currentGrahamPoints, 2, true); break; case JARVIS: drawLineStrip(LineStrip(jarvis->getEnveloppe()), 2, true); break; case TRIANGULATION2D_QCQ: drawTriangleStrip(*triangulation2D_qcq, 2); break; //case TRIANGULATION_2D_DELAUNAY_BOWYER_WATSON: // drawTriangleStrip(*triangulation2D_Delaunay_Bowyer_Watson, 2); // break; case TRIANGULATION_2D_DELAUNAY: drawTriangleStrip(*triangulation2D_Delaunay, 2); break; //case DELAUNAY: // std::cout << delaunay->computeTriangles().size() << std::endl; // drawTriangleStrip(TriangleStrip(currentLine->getPoints(), delaunay->computeTriangles()), 2); // break; case VORONOI: //drawLineStrip(LineStrip(voronoi->getArea()), 2, true); drawLineStrip(LineStrip(voronoi->getPoints()), 1, true); drawLineStrip(LineStrip(voronoi->getMediatriceP()), 2, true); drawCircle(voronoi->getRadius().at(0), *voronoi->getActualPoint().at(0)); drawCircle(voronoi->getRadius().at(0), *voronoi->getActualPoint().at(1)); drawLineStrip(LineStrip(voronoi->getIntersect()), 2, true); break; case NONE: break; default: break; } drawLineStrip(*currentLine, 2, false); #else if(currentLine != nullptr) drawLineStrip(*currentLine, 2, false); if(currentJarvisPoints != nullptr) drawLineStrip(*currentJarvisPoints, 2, true); if(currentGrahamPoints != nullptr) drawLineStrip(*currentGrahamPoints, 2, true); #endif glutSwapBuffers(); // Double buffer ? glFlush(); // Forces refresh ? }
static void Draw(EGLDisplay dpy, EGLSurface surf) { glViewport(0, 0, windW, windH); glDisable(GL_SCISSOR_TEST); glPushAttrib(GL_COLOR_BUFFER_BIT); glColorMask(1, 1, 1, 1); glIndexMask(~0); glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glPopAttrib(); if (mode1) { glShadeModel(GL_SMOOTH); } else { glShadeModel(GL_FLAT); } if (mode2) { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } else { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } Viewport(0, 0); Point(); Viewport(0, 1); Lines(); Viewport(0, 2); LineStrip(); Viewport(0, 3); LineLoop(); Viewport(1, 0); Bitmap(); Viewport(1, 1); TriangleFan(); Viewport(1, 2); Triangles(); Viewport(1, 3); TriangleStrip(); Viewport(2, 0); Rect(); Viewport(2, 1); PolygonFunc(); Viewport(2, 2); Quads(); Viewport(2, 3); QuadStrip(); glFlush(); if (doubleBuffer) { eglSwapBuffers(dpy, surf); } }