PDA

View Full Version : Is there a problem in my VC++ compiler?



Ehsan Kamrani
05-27-2005, 08:21 AM
I'm attemting to compile a program. This program uses from the multitexturing extensions.
i have included the file glext.h in my program.But when i want to declare them with the following lines, i recieve some errors.
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL;
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL;

syntax error : missing ';' before identifier 'glMultiTexCoord2fARB'

'PFNGLMULTITEXCOORD2FARBPROC' : missing storage-class or
type specifiers

fatal error C1004: unexpected end of file found

Is there a problem in my VC++6.0 compiler?
-Ehsan-

jide
05-27-2005, 09:06 AM
No, it's not a problem from your compiler.

You have several choices to load an extension nowaydays. Whether you declare GL_GLEXT_PROTOTYPE so you can directly have major 'extensions functions' that matches your gl version, or whether you manually (and somewhat oldly) define the function declarations.

I'm used to do the old way, so maybe this isn't what you want. But this allow you to name the function with whatever you want, so not forcedly gl prefixed.


// in header:

typedef void
(*PFNGLMULTITEXCOORD2FVARBPROC) (GLenum t, GLfloat *tx);

PFNGLMULTITEXCOORD2FVARBPROC MultiTexCoord;

// in source
#include "the_header"

PFNGLMULTITEXCOORD2FVARBPROC MultiTexCoord = 0;

void
LoadGLExtensions()
{
MultiTexCoord = (PFNGLMULTITEXCOORD2FVARBPROC) wglGetProcAddress (multi_tex_coord_2fv_arb);

if (!MultiTexCoord)
throw std::exception();
}There are good tuts on how to load them in many sites (and surely here too).

But multitexturing doesn't need to be loaded as an extension now since this is an added functionality on gl 1.2.

So, am I missing something from you ?

Other things that come to my mind: you probably have an old gl version (so ensure all your gl headers are recent - and the libs too). Also check for GL_GLEXT_PROTOTYPES (look at glext.h).

Hope that can help.

Ehsan Kamrani
05-27-2005, 09:43 AM
I'm using from the latest version.But as i have seen the file glext.h, the following type has been declared.
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);

So why i receive those errors? i believe that all the declarations are correct?:
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL;

Ehsan Kamrani
05-27-2005, 10:36 AM
I undersood!
I am using from the OpenGL 1.2 header file--I mean <gl.h>. in this case i couldn't use from those declarations.I replaced the new header file with previous header file( version1.1) and compiled my program.
So we cannot use from those declarations in the new version.

dorbie
05-27-2005, 06:39 PM
There's nothing wrong with your code, those should be typedef'd in your header so there's no difference with that and what the other poster wrote, I think the problem is that PFNGLMULTITEXCOORD2FARBPROC isn't declared in your glexh.h, this may be because of the compiler preprocessor and defines.

Specifically, multitexture is part of the core in 1.3 but not in 1.2 (where it was ARB) and before that it was an EXT so the tokens could change or be preprocessed out depending on typedefs like:

#define GL_VERSION_1_1 1

Without looking at your headers and knowing where they came from it's tricky to know exactly what happened.

It might be best to use something like GLEW for your extensions and sidestep all this crap :-).

http://glew.sourceforge.net/

Ehsan Kamrani
05-28-2005, 12:12 AM
Hi Angus
Thank you very much.I'll check inside the header files and attempt to use from that glew.
-Ehsan-