How to: from OpenGL 2.1 to 3.3 core?

Greetings,

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

http://www.arcsynthesis.org/gltut/index.html

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); 
   glutInitContextVersion(3,3); 
   glutInitContextProfile(GLUT_CORE_PROFILE);
   glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
   
   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;
      exit(EXIT_FAILURE);
   } else {
      cout<<"OpenGL 3.3 supported."<<endl;
   }

   //attach your callbacks setup OpenGL initialization stuff
   
   glutMainLoop();
}

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 http://www.sfml-dev.org/forum/viewtopic.php?t=1817&sid=339613d0b27611eddb554cc365cb819e
Moreover, this blog entry tells u how to create an opengl3 context in sfml. http://rastergrid.com/blog/2010/01/flawless-alternative-to-sdl/

Alright, thank you very much!