// Drawable circle ------------------------------------------------------------- #include "drawable_circle.h" #include "utils.h" #include #include using namespace std; // Static class members -------------------------------------------------------- int Circle::DisplayListId = -1; // Constructor ----------------------------------------------------------------- Circle::Circle(const double pX, const double pY, const double pZ, const double pRadius) : Drawable(pX, pY, pZ) { radius = pRadius; if (DisplayListId < 0) { DisplayListId = glGenLists(1); glNewList(DisplayListId, GL_COMPILE); { render(); } glEndList(); } } // Draw ------------------------------------------------------------------------ void Circle::draw() { glPushMatrix(); glColor3fv(color); glTranslatef(x, y, z); glCallList(DisplayListId); glPopMatrix(); } // Render ---------------------------------------------------------------------- void Circle::render() { draw_circle(0.0, 0.0, radius, 32); } // vim: set sts=4 sw=4 ts=8 ft=cpp: --------------------------------------------