PDA

View Full Version : Starting opengl freeGlut opengl 4.1 context



doodle
02-14-2011, 10: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.

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


glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
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 {
if (GLEW_VERSION_4_1)
{
cout<<"Driver supports OpenGL 4.1\nDetails:"<<endl;
}
}

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

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

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

doodle
02-15-2011, 10: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>

::duh::