3

I don't understand how to load OpenGl so that I can start using the functions in it. At first I thought it would be as simple as Allegro, where I just specify the location of the library, but I guess not.

Can someone either teach me how to install OpenGl into Visual Studio 2012 or show me a simpler, just as powerful graphics library?

Jasper Lu
  • 173
  • 1
  • 2
  • 9
  • 3
    Usually it's as simple as "#include " and linking to OpenGL32.lib. Have you tried that? – Drew Hall Sep 29 '12 at 23:28
  • Really? I was reading the opengl tutorial on their website and they say that I have to use something to load the opengl context, and then another thing to load the window or something – Jasper Lu Sep 29 '12 at 23:54
  • Drew Hall has answered the question of how make OpenGL functions available for use with Visual Studio. But it sounds like you may be asking how use create an OpenGL context and attach it to a window so that you can do something with it. That is more complicated, and the tutorial you have located will explain the details. – Mark Taylor Sep 30 '12 at 00:31
  • Can you explain to me in simple terms what an OpenGL context is? If I just use the OpenGL functions, will the window load when I run it like in Allegro, or will I have to create this context? – Jasper Lu Sep 30 '12 at 04:10
  • @user1608145: If you just call OpenGL functions nothing will happen. A OpenGL context is sort of the container for the OpenGL state machine. Without a GL context you cannot use OpenGL. The context again must be bound to a drawable, i.e. a window, off-screen PBuffer or such, so that it produces actual output. – datenwolf Sep 30 '12 at 07:53

1 Answers1

4

The best way to learn OpenGL is by example. Creating a context and getting it right the first time is rare. Browse through the examples and demos in the site here.

The examples are in VS 2010. You can convert them to VS 2012.

Ram
  • 3,045
  • 3
  • 27
  • 42
  • apparently there are separate programs like freeglut or something like that which I can use to create the context for me. However, I don't get how to use these programs. Do you think you can explain it to me – Jasper Lu Oct 01 '12 at 03:11
  • 2
    I would not recommend using GLUT, unless you're working on a demo or a small project. [Source.](http://blog.narendrasisodiya.com/2011/04/comparing-sdl-and-glut-please-don-use.html) I would like to recommend using SDL, which has a better learning curve than straight OpenGL. – tom_mai78101 Oct 07 '12 at 18:39