How to upgrade to OpenGL 2.1?

Hi, everyone,
I’m a newbie in OpenGL progamming. I was trying to run some example codes in OpenGL Progamming Guide (6th ed.) by Shreiner etc., which are based on OpenGL 2.1. I’m using Windows XP, MS Visual Studio 2008, and has installed a NVIDIA GeForce 8800 Ultra. It seems the programming environment only support OpenGL 1.1 even though I upgraded to the latest Microsoft SDK v6.1. (I checked gl.h. It has a line: #define GL_VERSION_1_1 1)
I also upgraded to the latest NVIDIA driver and installed NVIDIA OpenGL SDK 10, but it didn’t help. I’m wondering how I could upgraded it to the latest version of OpenGL. Any suggestions will be appreciated.

Jian Wu

Read this
on the OpenGL libraries and headers shipping with Microsoft compilers and OSes.
You need an extension loading mechanism to use any feature above OpenGL version 1.1. (Search for GLEW, it makes that step very easy.)

If you correctly installed the graphics drivers you directly downloaded from, you should be able to select a pixelformat with OpenGL 2.1.

Check what glGetString() returns with GL_VENDOR, GL_RENDERER and GL_VERSION to see if you picked the correct pixelformat in your examples.
The NVIDIA SDK OpenGL examples should pick the right formats.

Hi, Relic,
Thank you very much for the suggestions. I tried the method described in wiki. However I still got a compiling error:
“error C2373: ‘glFogCoordf’ : redefinition; different type modifiers”
My code begins with:

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include <GL/wglext.h>

static GLfloat f1, f2, f3;


glFogCoordf = (PFNGLFOGCOORDFPROC) wglGetProcAddress(“glFogCoordf”);

Jian Wu

You should have simply used GLEW as recommended, seriously.
It loads all extension function pointers which are supported by the implementation.

What you got is a mismatch of includes or the “extern” is simply bogus because you define the function in that module.

Start with some example which actually works.

It works finally. Thank you very much!
Jian Wu

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.