How to: from OpenGL 2.1 to 3.3 core?


To get started, I would like to know, if possible, how to force 3.3 core with Glew?

If not, is there any example I can chew on, using gl3.h?

Thank you

Ok thank you, can you be a little more specific?

For OpenGL 3 context creation, you need the latest version of freeglut and glew. Your main function is as follows,

void main(int argc, char** argv) {
   glutInit(&argc, argv); 
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );
   glutInitWindowSize(width, height);
   glutCreateWindow("Demo OpenGL 3.3");
   GLenum err = glewInit();
   if (GLEW_OK != err) {
      cerr<<"GLEW Error: <<glewGetErrorString(err)<<endl;
      return 1;
   // Only continue, if OpenGL 3.3 is supported.
   if (!glewIsSupported("GL_VERSION_3_3"))
      cerr<<"OpenGL 3.3 not supported."<<endl;
   } else {
      cout<<"OpenGL 3.3 supported."<<endl;

   //attach your callbacks setup OpenGL initialization stuff

Hi mobeen, I see, but what if I don’t want to use Glut or FreeGlut? Using SFML or SDL.

Then have a look at their own site if their latest version allow the creation of GL 3 contexts. As far as I remember, SDL has planned to do so or has experimental release of this. Don’t know about SFML.

SFML v2 handles opengl3 as given here
Moreover, this blog entry tells u how to create an opengl3 context in sfml.

Alright, thank you very much!