glext.h not working properly

Started by
2 comments, last by Gorgi 17 years, 11 months ago
Hi there , I started OpenGL programming in C (.net) a while ago. Some OpenGL functions (such as glActiveTexture , originally defined in glext.h) wouldn't work properly (undeclared identifier error) unless I added lines like this in my code: PFNGLACTIVETEXTUREPROC glActiveTexture =(PFNGLACTIVETEXTUREPROC) wglGetProcAddress ("glActiveTexture"); It didn't matter much then because the functions were few. Now I started programming in GLSL and I need many functions defined in glext.h , and it is rather inconvenient to do the above for every single function I need to use. How is it possible to have these functions properly defined in glext.h as they should?
Advertisement
Quote:Original post by Gorgi
Hi there , I started OpenGL programming in C (.net) a while ago. Some OpenGL functions (such as glActiveTexture , originally defined in glext.h) wouldn't work properly (undeclared identifier error) unless I added lines like this in my code:

PFNGLACTIVETEXTUREPROC glActiveTexture =(PFNGLACTIVETEXTUREPROC) wglGetProcAddress ("glActiveTexture");

It didn't matter much then because the functions were few. Now I started programming in GLSL and I need many functions defined in glext.h , and it is rather inconvenient to do the above for every single function I need to use. How is it possible to have these functions properly defined in glext.h as they should?
Welcome to the wonderful world of OpenGL Extensions! [smile]

As you've found out, including glext.h isn't all you need to do. You still need to get a pointer to the functions so that you can actually use them. I recommend, instead of doing all that manually, just use an extension loading library such as GLee or GLEW. It is much less of a hassle that way.
Instead of repeating this everytime, read the wiki or show them the way to the wiki http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=3;t=014353
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
glee.h did the job just fine , thanx a lot :)

This topic is closed to new replies.

Advertisement