Trying a simple OpenGL program

Joined
Feb 13, 2009
Messages
1
Reaction score
0
Points
1
Hi,

I am trying to achieve something very simple, but it seems I'm still doing something wrong... I try to get the version etc what OpenGL reports.
How can I properly do this?

I have this at the moment:
Code:
#include <AGL/agl.h>
#include <stdio.h>

int main ( )
{
        GLint attribs[] = { AGL_RGBA,  // 1
                            AGL_DOUBLEBUFFER,
                            AGL_SAMPLE_BUFFERS_ARB, 1,
                            AGL_SAMPLES_ARB, 2,
                            AGL_SUPERSAMPLE,
                            AGL_NO_RECOVERY,
                            AGL_NONE };

        AGLPixelFormat pixelFormat = NULL;
        AGLContext context = NULL;
        pixelFormat = aglChoosePixelFormat (NULL, 0, attribs); // 2


        if (pixelFormat) {
            context = aglCreateContext (pixelFormat, NULL); // 3

            printf( "%s\n", glGetString(GL_VENDOR) );

            aglDestroyPixelFormat (pixelFormat);
        }

        return 1;
}

which I compile via:
Code:
g++ -framework OpenGL -framework AGL test.cpp && ./a.out

And which gives at my prompt:
Code:
(null)


What did I do wrong?


Thanks a lot!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top