glGenBuffers not exist

Hello everyone,

I’ve read in OpenGL (higher than 1.5) I could make use of the function “glGenBuffers”.

Now I have also read, my operating (Windows 7) doesn’t support OpenGL higher than 1.1 .

But when I call the command “glGetString(GL_VERSION)” I receive the return: “2.1.0 - Builder 8.15.10.1883”.

So I think my hardware would support 2.1, but only my header files for cpp aren’t good.

But downloading new headers (GL.h and GLU.h) doesn’t work because than I get the error of extern function missing.

Could someone tell me what to do now, to make “glGenBuffers” work?

Thanks,

Dennis

You need to get pointers to functions above version 1.1. I recommend you to use an extension loading library for that.

I’ve already read a little about GLEW, but for GLEW I need extra dll’s, and I don’t really like that.

And I think it should not really be needed, because I already have the functions for 2.1 on my computer, but they aren’t accessible.

So I hoped someone could tell me how to do it without extra dll’s.

GLEW can be statically linked to your project so that you don’t need DLLs. Simply define GLEW_STATIC before including glew.h, and link to glew32s.lib. On a Windows PC, you NEED to use function pointers, which can be easily acquired using an extension loading library. As Zyx said, everything not included in opengl 1.1 on Windows has to be acquired via extension loading.

Included in the glew binaries is a utility program called glewinfo.exe. This will generate a text file that shows which functions pointers are accessible on your 2.1 implementation. It is entirely possible that your driver supports 2.1, but doesn’t support glGenBuffers (I have some old ATI OpenGL 2.0 drivers that do just that), but that is bug in the implementation which can only be fixed by updated drivers.

It is a common opinion here that extension handling library should be used, but if you want to do it on your own try the following:


#include "glext.h"
#include "wglext.h" // not needed for this, but...
//...
PFNGLGENBUFFERSPROC glGenBuffers = NULL;
// while GL context is active...
glGenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffers");

Everything can be done even without glext.h, but I won’t risk to be criticized for giving to complex and time consuming solutions. :slight_smile:

If you want to access those functions from whatever part of your code, make function-pointers global.

When using GLEW, and when making the pointer myself, I get the same error.

Compiling works, but when running (in VC++ 2010) I get the error which will break the program.

What is the error?
Check if glGenBuffers is equal to 0.

I already found the call who made the error.

Now it works.

Thanks for help everyone! :slight_smile: