Greg Ercolano wrote: > I could probably make it work if I made it more like the fractal.cxx > program where the fltk widgets are in an FLTK window, and the glut stuff > in a separate window. Might try that next.
I translated this into a pure glut application, and it runs fine. So this verifies glut is OK. (In this case, no linkage to FLTK is needed at all. Not really useful for debugging the problem but at least verifies the example code and glut is OK) jseb; I'm guessing the problem might be in fltk2's own glutInit() that is omitting something that the real glut library wants set. I'd suggest waiting for others to reply, and if they can't help, log an STR against FLTK2. #ifdef _WIN32 #include <windows.h> #endif #include <math.h> #include <GL/glut.h> #define WIDTH 640 #define HEIGHT 480 // // Render a simple opengl shaded sphere with a single side light -- erco 11/28/08 // pure glut version (no FLTK linkage needed) -- erco 03/14/11 // // RESHAPE THE VIEWPORT void Reshape(int W, int H) { // (REFERENCE: SGI light.c DEMO) GLfloat ratio = (float)W / (float)H; glViewport(0, 0, (GLsizei)W, (GLsizei)H); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1.5*ratio, 1.5*ratio, -1.5, 1.5, -10.0, 10.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void Redraw() { static int valid = 0; if (!valid) { valid = 1; Reshape(WIDTH, HEIGHT); // (REFERENCE: SGI 'light.c' EXAMPLE) GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; // RGBA GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; // RGBA GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; // RGBA GLfloat light_position[] = { 5.0, 5.0, 0.0, 0.0 }; // XYZ glClearColor(0.0, 0.0, 0.4, 0.0); // bg color glShadeModel(GL_SMOOTH); // glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialf(GL_FRONT, GL_SHININESS, 20.0); glLightfv(GL_LIGHT0, GL_POSITION, light_position); // glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glColor3f(0.5, 0.5, 0.5); glutSolidSphere(0.5, 30, 30); glPopMatrix(); } int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitWindowSize(WIDTH, HEIGHT); glutCreateWindow("sphere"); glutReshapeFunc(Reshape); glutDisplayFunc(Redraw); glutMainLoop(); return(0); } _______________________________________________ fltk-opengl mailing list fltk-opengl@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-opengl