There are several tools that can aid in the debugging of your OpenGL program.
Download from http://glintercept.nutty.org
This is free and also open source, for Windows. You need to install it which will create a folder C:\Program Files\GLIntercept0_5 for version 0.5. The folder will have a few gliConfig.ini (gliConfig_AuthorStd.ini, gliConfig_ExtOverride.ini, etc) that are basically example INI files for you to study and understand what you can do with this tool. In the same folder, you will find a fake OpenGL32.dll. Drop the DLL and your INI in the folder of your EXE and run your EXE. All function calls will go through the fake DLL and this is how GLIntercept detects if your program generated an error, if it called a GL function when there was no GL context, if your program is leaking resources. You can configure it so that it dumps a file when you press ctrl+shift+8. The XML files shows all the GL functions called, which ones generated a problem, the texture used, the shader used. The program also generates a log file with information on any problems detected.
Cons: The program is intended for applications that have a single GL context.
More to come.