I’m trying to code some lightmap-code, but i have problem, compiler says “Undefined symbol ‘GL_COMBINE_ARB’” and undefined macros and functions. Do i have missing file or something?
I think yu have to include glext.h
Hmmm… I have included that file. So what is da problem?
mmm. it seems that i dont have glext.h, where could i get it.
you can find it here : http://lhl.linuxgames.com/glext.h
anyway, it has a GL_COMBINE_EXT, but not a GL_COMBINE_ARB. are you sure of the spelling ?
Oh great, now the linker buggers ‘Unresolved external ‘glClientActiveTextureARB’’
So how could i solve that problem?
You’ll have to use wglGetProcAddress to get the address for that function.
Read some information on using extensions, it’ll help you out.
<cough> How could that solve my problem?
Anyway, here’s the code:
//here you should check if it’s NULL and act accordingly
You’ll need to do something similar to use other extensions as well.
edit: didn’t notice the Client part, and i’m assuming you use windows
[This message has been edited by t0y (edited 09-05-2002).]
So i should use that instead of ‘glClientActiveTextureARB’
Nooo! You write that before calling glClientActiveTextureARB IdIdeally you do that once at the beginning of your program, just after OpenGL initialization. And remember, as t0y has said, glClientActiveTextureARB must be declared as a global variable.
Global var- so i can call it from any file?
PFNGLCLIENTACTIVETEXTUREARBPROC is a typedef for a function pointer. wglGetProcAddress gets an address from a dll to assign to that pointer.
Now when you do this:
You are creating an INSTANCE of the pointer to be used. In the case of function pointers, you can use them just like the function. (The prototype is essentially defined in the typedef for that function pointer.)
Until you use wglGetProcAddress to point your instance to the correct function, you will not be able to use your function pointer yet, though.
The reason you make it global is so that you can use it like you use all other gl functions. If it was local to a function, you could ONLY use it in that function.
Now, if you want to use it from multiple files, you should put this in a header:
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
And then in ONE and ONLY ONE .c/.cpp file do:
Then in any of the .c/.cpp files that needs to use that, you #include that header with the extern. But, before using it you still have to do the wglGetProcAddress somewhere. It can be done in a separate .c/.cpp file, but it has to be done somewhere, and only needs to be done once.
Yeah yeah, that’s what i know.
Oh… Now compiler buggers about two declarations of ‘__stdcall glClientActiveTextureARB(unsigned int)’
looks like you’ve declared it in a header, which is included in 2 source files. is it that ?
Deiussum has shown the right way to do.
If you don’t like declaring globals in a .cpp file, what you can do is the following :
at the beginning of your .h, write :
#define DECLARE_GLOBAL extern
and then, in one and only one of the .cpp’s which include this .h, just before including this .h, add :
then, right before your global declaration, add :
DECLARE_GLOBAL int a;
hope that helps
[This message has been edited by Morglum (edited 09-06-2002).]
Speaking of that… Haha!! Compiled! It works! But how can i make sure that it’s REALLY working…?