PDA

View Full Version : glActiveTexture and GL_TEXTURE*



Rapzoph
04-12-2010, 03:46 AM
Hi all,

I have been working under linux using eclipse, gcc, opengl and cg. The program uses glActiveTexture with a GL_TEXTURE* as a parameter and runs correctly.

I'm trying to make the same program work under windows, still using eclipse, gcc, opengl and cg. After the first compile it couldn't find any of GL_TEXTURE* or glActiveTexture, even though all the other opengl functions worked fine.

I included glext.h ( even though i didn't need it under linux ) and it was able to find all GL_TEXTURE* but not glActiveTexture.

Is there something special about glActiveTexture under Windows ? Why do I have to include glext.h under windows and not linux ?

Thankyou

strattonbrazil
04-12-2010, 10:22 AM
Those libraries are made by the the driver developers and Microsoft, so they can decide how to expose the different drivers. glActiveTexture was an extension at some point and I guess at some point some developer decided to move it to a different file.

Rapzoph
04-13-2010, 12:29 AM
hmmm :-s.

I set out looking for where glActiveTexture might have been moved. To my suprise I found it in gl.h, along with all the GL_TEXTURE*s (where it should be :-)). This defies my logic, as I would think that including gl.h should do the job (my problem is not a link error).

Rapzoph
04-13-2010, 12:44 AM
ok, found it !

I had missed this during my first look in gl.h :

/* Under Windows, we do not define OpenGL 1.2 & 1.3 functionality, since it is treated as extensions (defined in glext.h) */

So I had a better look in glext.h and found glActiveTexture, I then saw this little whippersnapper :

#ifdef GL_GLEXT_PROTOTYPES

So I defined GL_GLEXT_PROTOTYPES in my project and that got rid of the compile errors.

But, as usual, one train hides another and a compile error hides a link error :-).

Rapzoph
04-13-2010, 01:18 AM
This was more ( but at the same time less ) complicated than I thought...I was looking for something like libGLext.a, but I couldn't find it.

I found out that GLee did the exact job I wanted to do so I just downloaded it from the opengl.org and included it insted of including gl.h and glext.h. I don't need to define GL_GLEXT_PROTOTYPES anymore either.

So everything is hunky. Don't quite understand it all ( and if anyone would like to explain that would be cool ) but I think thankyou GLee is in order.

Thanks for the reply strattonbrazil, it put me on the right track.

Code on !

ZbuffeR
04-13-2010, 05:23 AM
Explanations here :
http://www.opengl.org/wiki/Getting_started#OpenGL_2.0.2B_and_extensions

Simple solution : use GLee or GLEW.