PDA

View Full Version : wglGetProcAddress & Extentions



Rudi_P
03-19-2001, 06:31 AM
I am trying to use the GL_KTX_buffer_region extention but I'm having trouble defining the functions, below are a few examples of how I have tried to define them and the error messages I have received. This is for Win98 and I have a Geforce 2 MX so it should support it.

extern GLuint APIENTRY glNewBufferRegion (GLenum);
typedef GLuint (APIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum type);


if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_KTX_buffer_region") != NULL)
{
glNewBufferRegion = (GLuint(*)(GLenum))wglGetProcAddress ("glNewBufferRegion");
}

error C2659: '=' : overloaded function as left operand

OR

PROC glNewBufferRegion;


if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_KTX_buffer_region") != NULL)
{
glNewBufferRegion = wglGetProcAddress("glNewBufferRegion");
}

(*glNewBufferRegion)(GL_KTX_Z_REGION);

error C2197: 'int (__stdcall *)(void)' : too many actual parameters

Any help would be greatly appreciated!!!

Also the gfx.h header that comes with the 3D Studio Max 3.1 SDK is meant to define the constants but doesn't, anyone know why.

Relic
03-19-2001, 08:01 AM
What about
typedef GLuint (APIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum type);
PFNGLNEWBUFFERREGIONPROC glNewBufferRegion = NULL;
...
glNewBufferRegion = (PFNGLNEWBUFFERREGIONPROC) wglGetProcAddress("glNewBufferRegion");

PS: Forgot the brackets in the cast.

[This message has been edited by Relic (edited 03-20-2001).]

Rudi_P
03-20-2001, 03:52 AM
Cheers, worked a treat!!!