header files

Sorry if this is a very basic question, but my c++ compiler complains about things like glEnable(GL_FRAGMENT_PROGRAM_ARB), in fact about everything which is an extension. Which is no wonder since I only include standard 2001 mesa gl.h. On linux, there is something like “glext.h” from nvidia, which supplies all the extensions, but how do I enable that on windows? Simply take the linux include files? Download something somewhere? Pleas help… I never coded OpenGL on windows and now I have some trouble getting started with these things.

For all things related to extension (and GL2.0) I advise you to use the cross-platform library GLEW .

thanks, looks interesting, but not perfectly suitable, as I am simply porting an existing application to windows, and there shoud be only really neccesary changes in the sourcecode. What ist the “standard” way to deal with extensions?

You can download the current glext.h from this site:
http://www.opengl.org/registry/

thank you.

now i put

PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC )wglGetProcAdress("glActiveTextureARB ");

into my program, include windows.h, glext.h and wglext.h, it compiles, but the linker still says “undefined reference to glActiveTextureARB@4”.

What to do? I use wxdevc++.

You have a space in the string "glActiveTextureARB ". Try removing it.

that was just mistyped here in the forum (opengl is on another computer, so i cannot copy+paste)

Wait, the linker complains ? Strange.
Maybe try the sample here :
http://www.opengl.org/wiki/index.php/Getting_started#OpenGL_2.0_and_extensions

Now I got it compiled and linked, but now the program crashes when trying to use one of the extension functions. I will try GLee, it looks very simple. GLEW doesn’t seem to work with wxdevcpp, which I am using.

GLEW doesn’t seem to work with wxdevcpp

Well I am using it with devcpp :slight_smile:
Anyway both libs are nice.

If you do so, would you like to eplain how? GLee doesn’t work, as well. Oviously I must be doing something wrong.

I got code like this:

#include “GLee.h”
#include “GL/glu.h”

class abc
{
public:
inline void setValues(float _a, float _b)
{
a=_a;
b=_b;
}
}

and so on. It always worked, but with GLee, the compiler says “expected primary-expression before ‘;’ token” to the line “a=_a;”. I find this very weird, but typical C++ type of problems. The most complex things are working fine, but I fail at simply linking one library.

at least I succeeded in compiling and running a simple opengl demo program with GLee… this gives some hope.

now I managed to compile and link the original (linux) version of the app with GLee… :slight_smile:

great.
So, what were the problems and how you solved them ?

With linux there never were any problems :wink: .

On Windows… the weird “expected primary-expression before ‘;’ token”… I am not really sure about it, but it seems that something somewhere has the same name as the “a” and “b” in my example. Renaming some member variables of some classes made it disappear. After that, the project compiled and linked with GLee on windows, but right now, it still crashes (but I didn’t expect it to run right from the start, it’s pretty complex). So I have some hope again.

Dev-C++
Linker options : -lopengl32 -lglu32
Be sure your files are compiled as C++.

I have this on top of my GL files (no gl.h) :

#define GLEW_STATIC 1
#include <GL/glew.h>

I don’t remember doing special tricks for it to work.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.