I have a GLUT-based data visualization application that allows a user to view a scene and manipulate that view using a UI. I want to add a “scripting mode” to the application where the user specifies an input file containing a sequence of commands to execute, and then the program executes those commands and then writes the contents of the display to a file.


I am trying to use OSMesa for this by using an OSMesa rendering context instead of the one generated by GLUT. I have tried to do this by calling the functions needed to make the OSMesa context instead of the glutCreateWindow() function. However, this doesn’t work: it gives an access violation exception as soon as glutPostRedisplay() is called.


Is it even possible to get GLUT to recognize an OSMesa rendering context, and if so, how?


(I am using the GLUT libraries that are generated by Mesa, not the system’s native GLUT libraries.)


-Alexander Mont


(Note that I already have the scripting mode working with the system’s own OpenGL libraries, and copying the contents of a window to a file from there. The reason I want to use OSMesa is because I want to run the scripting mode on machines which do not have windowing systems or even graphics cards.)