Multitexure Issues

Here is my code, (you can ignore the IL calls, I am using OpenIL to load my images).
Else where in the code I check for the use availability of the Multitexture, and CVA extensions. Then I set the flags, to true if its supported.

if(MultiTextureSupport == true && CompiledVertexArraySupport == true)
{
ilGenImages(1, &MapImage);
ilBindImage(MapImage);
ilLoadImage(MapTextureName);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(3, GL_FLOAT, 0,&Map.Texture1PT);
ilutGLBindMipmaps();
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(1,1,1,1);
ilDeleteImages(1, &MapImage);

ilGenImages(1, &MapLightImage);
ilBindImage(MapLightImage);
ilLoadImage(MapLightTextureName);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(3, GL_FLOAT, 0, &Map.Texture2PT);
ilutGLBindMipmaps();
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(1,1,1,1);
ilDeleteImages(1, &MapLightImage);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, &Map.VertPT);
glNormalPointer(GL_FLOAT, 0, &Map.NormalPT);

glLockArraysEXT(0, Map.NumInterleavedVerts);
glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, &Map.VertIndexPT);
glUnlockArraysEXT();
}

Why do I get these errors when I compile??

‘int (__stdcall *)(void)’ : too many actual parameters

I get this error 3 times, once for the lines containing my first glActiveTextureARB, my second glActiveTextureARB, and my glLockArraysEXT. Any ideas why this is happening? I have tried everything to get it to work, and still nothing.??.. Please help…

Please post the declaration of those function pointers here. You seem to have declared the functions improperly, or you are using them incorrectly.

Here is all the code dealing with the declaration, and use of the extensions.

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <IL/il.h>
#include <IL/ilu.h>
#include <IL/ilut.h>
#include <math.h>
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>

PROC glLockArraysEXT = NULL;
PROC glUnlockArraysEXT = NULL;

PROC glActiveTextureARB = NULL;
PROC glMultiTexCoord2fARB = NULL;

void CheckExtensions(void)
{
glGetString(GL_EXTENSIONS);

if(strstr((const char *)glGetString(GL_EXTENSIONS), “ARB_multitexture”) != NULL)
{
glActiveTextureARB = wglGetProcAddress(“glActiveTextureARB”);
glMultiTexCoord2fARB = wglGetProcAddress(“glMultiTexCoord2fARB”);
MultiTextureSupport = true;
}

else
{
MultiTextureSupport = false;
}

if(strstr((const char *)glGetString(GL_EXTENSIONS), “EXT_compiled_vertex_array”) != NULL)
{
glLockArraysEXT = wglGetProcAddress(“glLockArraysEXT”);
glUnlockArraysEXT = wglGetProcAddress(“glUnlockArraysEXT”);
CompiledVertexArraySupport = true;
}

else
{
CompiledVertexArraySupport = false;
}
}

I first attempted using that PROCGLLOCKARRAYEXT, or something like that, i know thats not it, but its something similar, but that wouldnt compile either. I went to the extension registration page, and got the most current headers, is there something im doing wrong here? Also, how would i get the above to work with Linux, and mac ( if possible? )…

your problem is the PROC function pointer type. It is likely to be a generic function pointer type, ie a pointer to a function that has no parameters and that returns an int.

You need to specify a correct type for each function to reflect its return value and parameters.

For CVA :
typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
PFNGLLOCKARRAYSEXTPROC glLockArraysEXT = NULL;
PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT = NULL;

As for portability, no your code won’t work for Linux/Mac. It is due to the use of wgl. Under Linux, you have to use glx routines instead to get function pointers (don’t know about the Mac situation).

You have to include glext.h from http://oss.sgi.com/projects/ogl-sample/registry/
and you dont have to write extension functions prototypes(they are allready in glext.h).
I dont see in your code that you included glext.h. You only need to write function pointers declarations.
Hope this helps.

Thanks guys, worked like a charm, first time i tried the PFNGLLOCKARRAYSEXTPROC i never included the glext.h header, so i thought it was a syntax error. So i tried the Proc stuff, that didnt work. But now it works, so i thank you. anyone know what the linux, and mac version of wglGetProcAddress is?? I believe this is my only piece of windows code that must be used. So i am looking for the linux and mac equivilant so i can write OPEN code. Thanks for all your help.

[This message has been edited by dabeav (edited 05-25-2002).]

On Linux and every OS that uses XWindows it is glXGetProcAddressARB(it is extesion of GLX), on a Mac it is aglGetProcAddress but I’m not 100% sure.
Check docs for both versions of function.
Hope this helps.