PDA

View Full Version : Missing file?



runggu
09-03-2002, 08:27 AM
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?

Morglum
09-03-2002, 10:32 AM
I think yu have to include glext.h

runggu
09-03-2002, 09:17 PM
Hmmm... I have included that file. So what is da problem?

runggu
09-04-2002, 06:10 AM
mmm. it seems that i dont have glext.h, where could i get it.

Morglum
09-04-2002, 07:10 AM
you can find it here : http://lhl.linuxgames.com/glext.h

Morglum
09-04-2002, 07:11 AM
anyway, it has a GL_COMBINE_EXT, but not a GL_COMBINE_ARB. are you sure of the spelling ?

runggu
09-04-2002, 07:34 AM
Oh great, now the linker buggers 'Unresolved external 'glClientActiveTextureARB''

runggu
09-05-2002, 08:22 AM
So how could i solve that problem?

t0y
09-05-2002, 08:29 AM
You'll have to use wglGetProcAddress to get the address for that function.

Read some information on using extensions, it'll help you out.

runggu
09-05-2002, 08:36 AM
<cough> How could that solve my problem?

t0y
09-05-2002, 08:39 AM
Anyway, here's the code:




(...)
#include <gl/glext.h>

(...)

//globals
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;

void initializeARB(){
glClientActiveTextureARB=(PFNGLCLIENTACTIVETEXTURE ARBPROC) wglGetProcAddress("glClientActiveTextureARB");
//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).]

runggu
09-05-2002, 08:47 AM
So i should use that instead of 'glClientActiveTextureARB'

Morglum
09-06-2002, 12:18 AM
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.

runggu
09-06-2002, 05:10 AM
Global var- so i can call it from any file?

Deiussum
09-06-2002, 05:41 AM
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:
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;

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:
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;

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.

runggu
09-06-2002, 05:46 AM
Yeah yeah, that's what i know.

runggu
09-06-2002, 07:03 AM
Oh.. Now compiler buggers about two declarations of '__stdcall glClientActiveTextureARB(unsigned int)'

Morglum
09-06-2002, 07:11 AM
looks like you've declared it in a header, which is included in 2 source files. is it that ?

Morglum
09-06-2002, 07:17 AM
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 :
#ifdef DECLARE_GLOBALS_HERE
#define DECLARE_GLOBAL
#else
#define DECLARE_GLOBAL extern
#endif

and then, in one and only one of the .cpp's which include this .h, just before including this .h, add :
#define DECLARE_GLOBALS_HERE

then, right before your global declaration, add :
DECLARE_GLOBAL

for example,
int a;
would become
DECLARE_GLOBAL int a;

hope that helps
Morglum

[This message has been edited by Morglum (edited 09-06-2002).]

runggu
09-06-2002, 07:20 AM
Speaking of that.... Haha!! Compiled! It works! But how can i make sure that it's REALLY working..?

t0y
09-06-2002, 07:30 AM
You could try using it.. http://www.opengl.org/discussion_boards/ubb/smile.gif

You should try to find some information about the compile/link process that goes on when you build your application.

Function pointers also seem to be a little fuzzy for you, so the best would be to get a good book/tutorial on C/C++ that covers these matters.

I'm not against anyone that wants to learn on his/her own, but a good book won't do no harm..

runggu
09-06-2002, 07:34 AM
Well, i've tried my program, but i looks same than without it.

Morglum
09-06-2002, 08:51 AM
Try multitexturing with 2 very different textures... so you'll immediately see whether it works or not http://www.opengl.org/discussion_boards/ubb/smile.gif