View Full Version : glGenBuffers not exist
09-11-2011, 04:54 AM
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 220.127.116.113".
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?
09-11-2011, 05:21 AM
You need to get pointers to functions above version 1.1. I recommend you to use an extension loading library (http://www.opengl.org/wiki/Extension_Loading_Library) for that.
09-11-2011, 05:33 AM
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.
09-11-2011, 05:50 AM
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.
09-11-2011, 06:31 AM
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 "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. :)
If you want to access those functions from whatever part of your code, make function-pointers global.
09-11-2011, 06:40 AM
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.
09-11-2011, 06:54 AM
What is the error?
Check if glGenBuffers is equal to 0.
09-11-2011, 07:05 AM
I already found the call who made the error.
Now it works.
Thanks for help everyone! :)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.