Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glGenBuffers not defined?

Tags:

c++

c

opengl

I'm using windows and I notice that a lot of functions are grayed out because I guess #ifdef GL_GLEXT_PROTOTYPES is not defined. One of these is the VBO extension. Should I just define GL_GLEXT_PROTOTYPES? Otherwise how else can I use VBOs since im using OpenGL32.dll (I want my application to have no dll dependencies not included in Windows by default.) Thanks

like image 260
jmasterx Avatar asked Jun 13 '10 13:06

jmasterx


3 Answers

I recommend that you use GLEW to get rid of that problem.

It's a long story, but resuming, Windows' OpenGL library only exposes OpenGL 1.1 entry points, so all functions beyond that version are loaded with wglGetProcAddress. GLEW solves this problem by doing that.

http://glew.sourceforge.net/

Just link to GLEW and GLU/GLUT (if you use them).

like image 44
Dr. Snoopy Avatar answered Sep 28 '22 03:09

Dr. Snoopy


Yes, it's quite normal and expected to have something like:

#define GL_GLEXT_PROTOTYPES

#include <GL/GL.h>

If you're trying to write OpenGL 3 compliant code, you'd normally change that to:

#define GL_GLEXT_PROTOTYPES 1
#define GL3_PROTOTYPES 1

#include <GL3/GL3.h>
like image 129
Jerry Coffin Avatar answered Sep 28 '22 04:09

Jerry Coffin


You can use glad to provide glGenBuffers for you.

like image 43
Jichao Avatar answered Sep 28 '22 05:09

Jichao