How do I start using OpenGL 3.0/3.1

Hi folks,

Just planning to start coding using Visual C++ 2008 for some graphics drawing on a small project, one of my hobbies actually. Got books about OpenGL programming guide, C++ programming and a few others.

The hardware is Intel Q6600 and ATI Raedon 4870 1GB, know it’s not a top end setup but i just need it to do some static graphics objects so should be okay.

The OS is Vista, again know it’s not the best OS out there but can’t afford to upgrade at the moment so live with it.

Got a bit rusty on VC++ and my first time to use OpenGL, where do I download OpenGL and how do I call the various commands?

Appreciate for your help!


You could try the tutorials in my signature. They use OpenGL 3.3, which your hardware should support with a driver update.

Let me get this right, so you’re saying the following code in your tutorial is already available without me doing any extra coding in my Main() function?

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);


glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);

glDrawArrays(GL_TRIANGLES, 0, 3);



Let me get this right, so you’re saying the following code in your tutorial is already available without me doing any extra coding in my Main() function?

No. Unless you linked directly to this page without reading a word before that, I don’t know how you got that impression. And even then that doesn’t make since, because the text above that source clearly says that this is the “display” function, not “main.”

The page right before that page describes the layout of the tutorial, the interactions with FreeGLUT (which opens and manages the window), and where the actual “main” function is.

Excuse me, I didn’t express clearly about what I need.
I don’t know how OpenGL works in a Windows environment.
Do I need to download anything so that I can use the OpenGL commands?
If there are downloads, where do I need to place them into and do I need to make it when I build my C++ object code?

You know…things like this I need to know in order to get my self up to speed.

Just a summary:

Download the gl3.h header file from this website, not sure what else is required from memory, but you might need glext.h for the create context extension.

  1. Make a window

  2. Make a “standard” Windows OpenGL context

  • this is the one that the operating system supports automatically
  • automatically in this case means without you explicitly loading function pointers
  • this gets you OpenGL 1.1 + extensions, or possibly OpenGL 1.4 + extensions on Vista/Win 7, as far as I know…
  1. Load the function pointer that allows you to request an OpenGL 3 context
  • I think it’s WGL_ARB_create_context
  1. Use that function to create a context of the required version

  2. Once that succeeds, load function pointers for the GL version 3.x functions

  3. Use them to draw stuff

I see. So with just #include “glext.h” will do? You mean OpenGL libraries are built-in Windows, in my case Windows Vista?

There are two things you need (assuming you can create and manage windows in Win32): create an OpenGL context and load core and extension function pointers.

Detailed instructions for creating an OpenGL context are available. There are also a number of cross-platform toolkits available that abstract away window and context creation.

I would not suggest bothering with code for loading core/extension functions; there are plenty of extension loading libraries that you can use. They usually use their own headers, so you won’t use glext.h, gl3.h, or gl.h; read the instructions for that library.

Wanted to add the “Getting started” page from the GL wiki :