View Full Version : Starting opengl freeGlut opengl 4.1 context

02-14-2011, 09:41 PM
I am feeling comfortable working with free glut with openGL 2.1 context and I wanted to try some of the newer features of openGL. I can not however find the best way to get a context for 4.1 I saw some things that seemed to imply that with the new versions of Free glut I can get a 3.1 context but nothing beyond that.

Is there an alternative to FreeGlut that provides a 4.1 context and some one who just learned glut would feel comfortable with?I am working on debian/ubuntu.

02-15-2011, 01:23 AM
Couldn't you use freeglut the following way.

glutInit(&argc, argv);
glutInitContextVersion (4, 1);
glutInitContextFlags (GLUT_CORE_PROFILE | GLUT_DEBUG);
glutInitWindowSize(screen_width, screen_height);
glutCreateWindow("OpenGL 4.1");
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err) {
cerr<<"Error: "<<glewGetErrorString(err)<<endl;
} else {
cout<<"Driver supports OpenGL 4.1\nDetails:"<<endl;

02-15-2011, 11:34 AM
What version of is glutContextVersion in? Its no where in any of the docs I have found = /

Alfonse Reinheart
02-15-2011, 01:29 PM
What version of is glutContextVersion in?

The function is glutInitContextVersion. As in mobeen's example.

02-15-2011, 09:29 PM
Out side of terrible grammar the mistake I was making was including <GL/glut.h> Which does call free glut on a stock Ubuntu system but does not include the freeglut_ext.h

I needed to explicitly include <GL/freeglut.h>