Skip to content

Instantly share code, notes, and snippets.

@kovrov
Created October 13, 2011 13:20
Show Gist options
  • Save kovrov/1284195 to your computer and use it in GitHub Desktop.
Save kovrov/1284195 to your computer and use it in GitHub Desktop.
Mac OS X Lion OpenGL Core Profile (CGLChoosePixelFormat)
/* gcc -framework OpenGL main.c */
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl3.h>
#include <stdio.h>
int main(int argc, char **argv)
{
CGLContextObj ctx;
CGLPixelFormatObj pix;
GLint npix;
CGLPixelFormatAttribute attribs[] = {
kCGLPFAOpenGLProfile,
kCGLOGLPVersion_3_2_Core,
0
};
CGLChoosePixelFormat(attribs, &pix, &npix);
CGLCreateContext(pix, NULL, &ctx);
CGLSetCurrentContext(ctx);
printf("%s %s\n", glGetString(GL_RENDERER), glGetString(GL_VERSION));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment