PDA

View Full Version : Can not wglGetProcAddress() -- what is wrong with my code?



wolfgang
06-30-2004, 12:49 AM
Hi there!

I am just trying to migrate a small OpenGL application from Unix to Windows using the Cygwin environment for development. I was able to get my code running without any significant changes.

Now I wish to apply convolution which is OpenGL 1.2 functionality. It took some time to realize that anything above version 1.1 is not directly supported by Windows but that one must obtain function pointers via wglGetProcAddress(). Unfortunately, it only returns a null pointer -- why?

Here's a minimal example to produce that behavior:

#include <stdio.h>

#include <windows.h>

#include <GL/glut.h>
#include <GL/glext.h>

void display(void)
{
PFNGLGETCONVOLUTIONPARAMETERIVPROC glGetConvolutionParameteriv;

printf("VENDOR : %s\n", glGetString(GL_VENDOR));
printf("RENDERER : %s\n", glGetString(GL_RENDERER));
printf("VERSION : %s\n", glGetString(GL_VERSION));

glGetConvolutionParameteriv = (PFNGLGETCONVOLUTIONPARAMETERIVPROC)
wglGetProcAddress("glGetConvolutionParameteriv");

printf("address = %p\n", glGetConvolutionParameteriv);
printf("error = %d\n", GetLastError());

exit(0);
}

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutCreateWindow("Testwindow");
glutDisplayFunc(display);
glutMainLoop();

return 0;
}

The compiler is run like this:

$ gcc example.c -o example -lglut32 -lopengl32

And the output is like this:

VENDOR : ATI Technologies Inc.
RENDERER : Radeon 7500 DDR x86/SSE2
VERSION : 1.3.3038 Win2000 Release
address = 0x0
error = 127

The error code is
127 The specified procedure could not be found. ERROR_PROC_NOT_FOUND

So why doesn't this work? The OpenGL version available is 1.3 so glGetConvolutionParameteriv() should be available!?

Bye,

Wolfgang

zeckensack
06-30-2004, 02:01 AM
Convolution is part of the imaging subset which is optional, not core functionality. The Radeon doesn't support it.

wolfgang
06-30-2004, 02:44 AM
I see. I just tried a different function that definitely is supported (because it's in GL_EXTENSIONS) and that worked.

Is there a document on the net that lists all extensions that a particular chip implements? I am very interested to have convolution supported by hardware and now would like to find out which graphic boards can do that.

Thank you for the very quick answer,

Wolfgang

zeckensack
06-30-2004, 03:55 AM
Delphi 3D\'s hardware info database (http://www.delphi3d.net/hardware/index.php) is what you're looking for :)
Here (http://www.delphi3d.net/hardware/extsupport.php?extension=ARB_imaging) 's the entry for ARB_imaging btw.