I am very interested in what you are doing here. Here is about as simple of OpenGL as it gets.
// gcc -o test test.c -lauto -lgl
#include <GL/gl.h>
#include <stdlib.h>
#include <proto/intuition.h>
#include <proto/exec.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex2i(0,1);
glVertex2i(1,-1);
glVertex2i(-1,-1);
glEnd();
glFlush();
mglSwitchDisplay();
}
struct Interface *getInterface(char *libname)
{
struct Library *lib;
lib = IExec->OpenLibrary("minigl.library", 0);
if (lib)
return IExec->GetInterface(lib, "main", 1, NULL);
return 0;
}
void dropInterface(struct Interface *iface)
{
if (iface)
{
struct Library *lib = iface->Data.LibBase;
IExec->DropInterface(iface);
IExec->CloseLibrary(lib);
}
}
int main()
{
struct MiniGLIFace *IMiniGL = 0;
IMiniGL = (struct MiniGLIFace *)getInterface("minigl.library");
if (!IMiniGL)
return 20;
struct GLContextIFace *IGL = IMiniGL->CreateContextTags(
MGLCC_Width, 640,
MGLCC_Height, 480,
MGLCC_Windowed, TRUE,
MGLCC_CloseGadget, TRUE,
MGLCC_Buffers, 2,
MGLCC_PixelDepth, 16,
TAG_DONE);
if (IGL)
{
mglMakeCurrent(IGL);
int running = TRUE;
struct Window *win = mglGetWindowHandle();
if (!IIntuition->ModifyIDCMP(win, IDCMP_CLOSEWINDOW))
running = FALSE;
while (running)
{
display();
struct IntuiMessage *imsg;
while ((imsg = (struct IntuiMessage *)IExec->GetMsg(win->UserPort)))
{
if (imsg->Class == IDCMP_CLOSEWINDOW)
running = FALSE;
IExec->ReplyMsg((struct Message *)imsg);
}
}
mglDeleteContext();
}
dropInterface((struct Interface *)IMiniGL);
return 0;
}
Regards
Doug