PDA

View Full Version : OpenGL 1.X functions in gl3.h?



Schnulla
06-30-2010, 09:52 AM
Hi,

since I'm switching to OpenGL 3.2 (core profile) I
replaced all gl.h and glext.h includes with gl3.h.

Now the compiler complains about missing OpenGL 1.X
functions like glGetString() or glGenTextures().
I checked the gl3.h header and noticed I'll have to
bind these functions like extensions? Why is that?

In gl.h it was ready to use in this form:

WINGDIAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);

Please note I have no problems with binding extensions,
I'm just interested in why such "oldschool" functions
suddendly are not ready to use in a new header.

And I'm not sure which role GL3_PROTOTYPES plays in
this game but I guess it should NOT be defined for
Windows platform.

Hope someone can enlighten me :)

Thank you!

P.S. I know about GLEW, that is not the point here.

randall
06-30-2010, 11:43 AM
glGenTextures and others are there (gl3.h).

typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
...

But, you have to load them yourself.

Schnulla
06-30-2010, 02:00 PM
So my first assumption is correct that one has to bind
them like an extension via wglGetProcAddress?

For example:

glGetError= (PFNGLGETERRORPROC) wglGetProcAddress("glGetError");

But this gives me 0 so I guess I have to bind them
in a different manner?

randall
06-30-2010, 02:17 PM
To load 1.x functions you must use LoadLibrary and GetProcAddress functions. See msdn docs.

ugluk
06-30-2010, 03:25 PM
Maybe this is off-topic, but where is gl3.h hiding if you work under Linux?

ravage
06-30-2010, 03:53 PM
If your on windows there is a pthon script that will download the gl3.h file and create a gl3w.h file which can be used on windows. It basially auto generates all that proc address stuff. You should be able to google search to find the script.

kowal
07-01-2010, 04:34 AM
where is gl3.h hiding if you work under Linux?
/usr/include/GL3/gl3.h
(at least on my computer)

Schnulla
07-01-2010, 01:42 PM
Thank you guys!

ugluk
07-01-2010, 04:04 PM
Really? Which driver do you have, I suppose ATI? I am using NVIDIA drivers and there's no GL3 directory.

kowal
07-01-2010, 04:23 PM
It was quite some time ago, I downloaded gl3.h from registry and copied it there myself (sorry, I forgot about that).

from gl3.h:

gl3.h should be placed under a directory 'GL3' and included as'<GL3/gl3.h>'.


but as I'm still using compatibility profile (slowly moving toward core) I include old gl.h and glext.h headers + some enums defined by hand instead of gl3.h