SourceForge Logo  

<< Please note, this is a temporary page until I get some spare time on my hands!  - volunteers anybody? ;-)  >>

Developers wishing to join as a member of the project are very welcome. Please contact me to add you to the list.



The OpenGL Class Library (GLCL) is intented to be a set of C++ classes, available through static and dynamic libraries, that will allow the developer to create OpenGL applications using C++ quickly.

Similar functionality exists for C developers in the form of GLUT. However, it is not always easy to interface this with C++. It is also difficult to interface with Motif since GLUT has it's own event processing loop which you can't break into.

In addition, other useful functionality will be included that will allow images (.bmp, .raw, .tga etc..) and 3d object format files (.3ds, .asc, .dxf etc..) to be loaded in a platform independant way.
 

At present the library is undergoing major development. However, an early release (v0.0.1) is available for you to use. This contains enough functionality to create any number of OpenGL windows and assign certain events (KeyPress, Display, Resize) to each of them.

If you wish to contribute to this project in some way then please feel free to contact me

To show how the library can be used, consider the following example:

 
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <iostream.h>

#include "glcl.h"

GLWindow *window;

int   end = 0;

void InitGL(void)
{
    // Initialise GL stuff here
}

void myKeyPressEventRoutine(int key)
{
    switch(key)
    {
        case XK_Escape:
            end = 1;
            break;
        default:
            break;
    }
}

void myResizeEventRoutine(int width, int height)
{
    // Your window resize code would go here
}

void myDisplayEventRoutine(void)
{
    // Your display code would go here
}
 

int main(int argc, const char **argv)
{
    // --== Define the title of our window ==--
    char title[] = "OpenGL Class Library (GLCL)  :  Simple Test Program";

    // --== Attempt to create an OpenGL window and assign all events to it ==--
    try
    {
        // --== Create an OpenGL window ==--
        window = new GLWindow(argc, argv, title, 640, 480);

        // --== Assign the events to this window ==--
        window->EventFunction_KeyPress(myKeyPressEventRoutine);
        window->EventFunction_Resize(myResizeEventRoutine);
        window->EventFunction_Display(myDisplayEventRoutine);
    }
    // --== Catch any exceptions that may have been thrown ==--
    catch(glclException &glcl)
    {
        // --== Get reason for exception and display it ==--
        cout << "Exception caught: " << glcl.GetReason() << endl;
        exit(EXIT_FAILURE);
    }

    // --== Initialise any OpenGL parameters for our program ==--
    InitGL();

    // --== The main loop - stay in here until you need to exit ==--
    while(!end)
    {
        // --== Update the window ==--
        window->Update();
    }

    // --== Ensure we clean up ==--
    delete window;

    return(0);
}
 

In order to compile this example you would need to add the following to your makefile:

    Include path:    /usr/local/glcl/include
    Library path:    /usr/local/glcl/lib
    Library:         GLCL

For examples, see the demo programs supplied in the 'test' directory
 

Please note that I do not claim to be an expert in C++, nor do I claim to be an expert in OpenGL.  This library came about through a need to create OpenGL applications quickly in C++ without having to use GLUT.  Hopefully, it will serve as a useful aid for similar projects.

If you do find any problems, or can suggest any enhancements or additions, or even want to modify the source then please feel free.  However, I would request that any changes/additions you make be notified to me so they can be included in future releases.
 

Last Updated:  27th April 2000