Saturday, July 28, 2012

OpenGL version number

Here's a program to print the OpenGL version to the console:

#include <GL/gl.h>
#include <GL/glut.h>

#include <stdio.h>

static GLint window;

int main( int argc, char* argv[] )
{

  char *gl_vers;
  

  glutInit(&argc, argv);
  glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
  glutInitWindowSize(500, 500);
  window = glutCreateWindow( "Need a window to get the version.");

  gl_vers = (char *) glGetString(GL_VERSION);

  fprintf(stdout, "GL version:\n");

  if (gl_vers != NULL)
    fprintf(stdout, "%s\n", gl_vers);

  return 0;
}

Apparently my GL version under MinGW is 1.1.0 - disappointingly old skool!

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.