When I try to run an example from Erco's web page example I get this:
http://f.imagehost.org/0170/opengl_error.jpg

Here is the example:

#ifdef _WIN32
#include <windows.h>
#endif
#include <math.h>
#include <FL/Fl.h>
#include <FL/Fl_Window.h>
#include <FL/Fl_Gl_Window.h>
#include <FL/gl.h>
#include <FL/glut.h>
//
// Render a simple opengl shaded sphere with a single side light -- erco 
11/28/08
//     NOTE: Glut needed *only* for glutSolidSphere()
//
class MyGlWindow : public Fl_Gl_Window {
public:
    // RESHAPE THE VIEWPORT
    void Reshape(GLfloat W, GLfloat H) {
        // (REFERENCE: SGI light.c DEMO)
        GLfloat ratio = W / 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 draw() {
        if (!valid()) {
            valid(1);
            Reshape(w(), h());
            // (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();
    }
    // CTOR
    MyGlWindow(int X,int Y,int W,int H,const char*L=0) : 
Fl_Gl_Window(X,Y,W,H,L) {
    }
};
int main() {
     Fl_Window win(640, 480, "sphere");
     MyGlWindow mygl(10, 10, win.w()-20, win.h()-20);
     win.resizable(&mygl);
     win.show();
     return(Fl::run());
}


I do get this kind of errors with all FLTK OpenGl programs!
Is this a bug or somethig is bad in my system?

I run on my laptop Slackware Linux 12.2, my video drivers are instaled (Intel 
GM965). And I have tried the example with FLTK2 too, the same problem.
_______________________________________________
fltk-opengl mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to