Advice on structure for opengl programs

Hello all

I am working through various tutorials and redbook etc and am trying to develop a better understanding of the structure of an OpenGL program.

I’m using XCode on a mac, although my question is not specific to XCode I think.

I decided it would be good to have a basic template project which has all the essential components so I don’t need to start from scratch each time. My question is… does anyone have advice about what should be in this ‘template’ and what I should avoid adding.

To give an idea of what I have so far:

In addition to main.c, I have created separate files (.c and .h) containing:

a) the display function
b) the reshape function
c) an initialisation function
d) keyboard and mouse functions
e) idle function
f) custom shapes and colors
g) lighting
h) Camera

To provide a specific example, here is my “init.c” file:

#include "ODInit.h"
#include "ODLighting.h"
#include <GLUT/glut.h>

void ODInit(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_DEPTH | GLUT_RGBA );
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(500, 500);
    glutCreateWindow("< insert name here >");
    glMatrixMode(GL_PROJECTION);
    ODLighting();
}

My questions are… is this what other people do / is it a reasonable way to go? And does anyone have advice about gl functions which I absolutely should / should not include in my template (given that I am trying to make it a generic template for subsequent projects).

Thanks in advance

Dave