I extended the Fl_Gl_Window to allow me to customize the draw and handle 
functions and render using some classes I had already created.

I followed the instructions found on this site and got it working for the most 
part. It renders almost exactly like my win32 + OpenGL app except the viewport 
appears to be wrong. Instead of drawing to the entire window, there is always 
white space on the right on the screen. I noticed (by drawing a grid) that it 
seems to be set to an exact square instead of the size I gave to both the 
constructor of the Fl_Gl_Window child class and the glOrtho/gluOrtho2D function.

Is there something wrong with how I setup the Fl_Gl_Window or the ortho 
projection?

Here are some relevant code snippets:

class OGL_Window : public Fl_Gl_Window
{
        void draw();
        int handle(int);

public:
        OGL_Window(int X, int Y, int W, int H, const char *L)
    : Fl_Gl_Window(X, Y, W, H, L) {}

};

void OGL_Window::draw()
{
        // ... draw stuff here ...
        glClear( GL_COLOR_BUFFER_BIT );
        // INSERT Draw code here
        // Render the grid
}

int main(int argc, char **argv)
{
        int nWWidth = 1024;
        int nWHeight = 600;

        OGL_Window *window = new OGL_Window( 0, 0, nWWidth, nWHeight, NULL );
        window->end();
        window->show( argc, argv );

        window->make_current();
        glEnable(GL_CULL_FACE);
        glClearColor( 1.0, 1.0, 1.0, 1.0 );

        glViewport(0, 0, nWidth, nHeight);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho( 0.0, nWidth, 0.0, nHeight, 0.0, 1000 );

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

        return Fl::run();
}

_______________________________________________
fltk-opengl mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to