Hi everyone,
I am learning OpenGL using this book "Addison Weslay OpenGL Programming Guide 7th Edition 2009" aka the red book.
The author in the book has specified he is using OpenGL 3.0 / 3.1 with code and explanation he has presented in the book.

I am using Code::Blocks IDE, I checked my current OpenGL version by using " glGetString(GL_VERSION) " function. Please note that for Window management I am using SDL 1.2 downloaded from the official sdl website. The version I am using as given by the function is 2.1.8781.

The header files gl.h, glu.h came with Code::Blocks IDE, I downloaded the latest version of this IDE, however I downloaded the Opengl32.lib and glu32.lib from a website that I don't remember quite a while ago, also the opengl32.dll file is already placed in my System32 folder (I am using Win7). I am using Laptop that comes with a ATI Mobility Radeon HD 4330, my display drivers are up to date.

Now my concern is that I want to use the OpenGL version specified in the redbook. I went www.opengl.org/registry and I can't find the header files, static library and dynamic library files to download.

Can someone please guide me what I need to do to update OpenGL, which files to download and where?? etc...

For Windows, there are no header files or import libraries for newer OpenGL versions. Everything is done using the extension mechanism. That said, there is no need to do any of that yourself. It's a lot of work and requires even more work whenever a new version is released.
Use an extension manager library like glew instead. Include glew.h instead of gl.h directly, call glewInit() after creating a context and after that you won't notice that Microsoft made a few suboptimal decisions regarding OpenGL.

In the redbook, it says that the 3.0 version uses a new context called the forward compatible context and I want to use it then I have to make a function call to glutInitContextFlags() and glutInitContextVersion(). However, I would like to use SDL 1.2, is there a way to specify the context in SDL?

When you say that I should use GLEW, then it means that it already contains the necessary header, .lib, .dll files that I need to work with opengl 3.0?

If I do use GLEW, will I still need to download the glext.h from www.opengl.org/registry?

When you say that I should use GLEW, then it means that it already contains the necessary header, .lib, .dll files that I need to work with opengl 3.0?

If I do use GLEW, will I still need to download the glext.h from www.opengl.org/registry?

OpenGL itself requires nothing new. Everything is already on your system if your graphics card driver supports it. It just needs to be queried via the extension mechanism.

GLEW itself needs to be linked though, as usual for libraries. It can be linked either statically or dynamically. Remember to define GLEW_STATIC before including glew.h if static linking is desired. You should not need anything beyond what is already included with GLEW, but that depends largely on what compiler you are using. The precompiled libraries should work with all flavours of MSVC though.

I never really worked with SDL, so I cannot really answer any questions about that. Both GLFW and SFML seem to support modern OpenGL fine though.

OpenGL itself requires nothing new. Everything is already on your system if your graphics card driver supports it. It just needs to be queried via the extension mechanism.

GLEW itself needs to be linked though, as usual for libraries. It can be linked either statically or dynamically. Remember to define GLEW_STATIC before including glew.h if static linking is desired. You should not need anything beyond what is already included with GLEW, but that depends largely on what compiler you are using. The precompiled libraries should work with all flavours of MSVC though.

I never really worked with SDL, so I cannot really answer any questions about that. Both GLFW and SFML seem to support modern OpenGL fine though.

Thank you for the reply.

I have downloaded GLEW 1.90, I download the binary version, I am statically linking glew32.lib along with SDL.lib and SDLmain.lib(removed opengl32.lib and glu32.lib), replaced gl.h and glu.h inclusion from the program by glew.h and placed glew32.dll in my Systems 32 folder. My sample OpenGL program runs fine as it was already....

however, glGetString(GL_VERSION) still returns 2.1.8781.

I am not sure If I have everything I need or done it correctly... I think I should continue to learn with what I have... I am wasting a lot of time in this....

SDL 1.2 will not create an OpenGL 3 context for you. To get one with SDL, you have to use SDL2 and explicitly request a 3.x context using SDL_GL_SetAttribute with GL_CONTEXT_MAJOR_VERSION and GL_CONTEXT_MINOR_VERSION.

The version of OpenGL supported depends primarly on two things: your driver (which if you have the most up-to-date driver for your video card you don't really need to worry), and more importantly your hardware. OpenGL functionality is all implemented in the driver. When you make a call to query the version, the driver will return the maximum version IT supports, or the maximum version your graphics card hardware supports. Remember, OpenGL is a specification, the actual implementation (video-card HW and driver-specific) is a mixture of software and hardware implementations. If you have an older graphics card that doesn't support newer OpenGL functionality, then the driver will send back the version of OpenGL that your graphics card does support.

This has nothing to do with your header files or your .lib files that come with your system.

Even if your hardware doesn't support an OpenGL core version, you may still be able to run newer OpenGL functionality as extensions (look for ARB, EXT prefixes). You can use GLEW to query for these extensions support.

SDL 1.2 will not create an OpenGL 3 context for you. To get one with SDL, you have to use SDL2 and explicitly request a 3.x context using SDL_GL_SetAttribute with GL_CONTEXT_MAJOR_VERSION and GL_CONTEXT_MINOR_VERSION.

that might be it, I will try using the SDL 2.

What type of graphics card do you have?

ATI Mobility Radeon HD 4330

Other note, when I download the GLEW 1.90 win32 binary files, there was an .exe in its bin folder with name "glewinfo.exe", I executed and it generated a text file and what I think I did is to find out if all the functionalities provided by openGL versions are supported by my Video card ( I might be wrong here).The text file said...

GLEW version 1.9.0Reporting capabilities of pixelformat 1Running on a ATI Mobility Radeon HD 4330 from ATI Technologies Inc.OpenGL version 2.1.8781 is supported

From OpenGL Version 1.1 to OpenGL Version 3.0, all the fucntions had the status of 'OK', from 3.1 to 4.3 they were all "MISSING"