Hi,
Here comes the whole cube_box::draw( routine from test/cube.cxx
void cube_box::draw() {
lasttime = lasttime+speed;
if (!valid()) {
glLoadIdentity();
glViewport(0,0,pixel_w(),pixel_h());
glEnable(GL_DEPTH_TEST);
glFrustum(-1,1,-1,1,2,10000);
glTranslatef(0,0,-10);
glClearColor(0.4, 0.4, 0.4, 0);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(float(lasttime*1.6),0,0,1);
glRotatef(float(lasttime*4.2),1,0,0);
glRotatef(float(lasttime*2.3),0,1,0);
glTranslatef(-1.0, 1.2f, -1.5);
glScalef(float(size),float(size),float(size));
drawcube(wire);
glPopMatrix();
gl_color(FL_GRAY);
glDisable(GL_DEPTH_TEST);
gl_font(FL_HELVETICA_BOLD, 16 );
static GLuint DisplayList=-1;
if (DisplayList<0){ glDeleteLists(DisplayList, 1);
DisplayList = glGenLists (1);
glNewList(DisplayList, GL_COMPILE);
gl_draw(wire ? "Cube: wire" : "Cube: flat", -4.5f, -4.5f );
glEndList();
}
glCallList(DisplayList);
glEnable(GL_DEPTH_TEST);
// if an OpenGL graphics driver is installed, give it a chance
// to draw additional graphics
if (Fl::cfg_gfx_opengl) Fl_Gl_Window::draw();