PDA

View Full Version : Strange Compile-Time problem



ReAKtor
04-25-2003, 01:41 PM
This is a bit of a strange one. I'm trying to use OpenGL's glConvolutionFilter2D function.




glConvolutionFilter2D(GL_CONVOLUTION2D, GL_LUMINANCE, 3, 3, GL_LUMINANCE, GL_FLOAT, conv_filter2D[3][3]);


The problem is I get this error when compiling the code:




D:\Programs\OpenGL\Imaging\Imaging.cpp(186) : error C2065: 'glConvolutionFilter2D' : undeclared identifier
D:\Programs\OpenGL\Imaging\Imaging.cpp(186) : error C2065: 'GL_CONVOLUTION2D' : undeclared identifier
Error executing cl.exe.


I really don't understand it. It is spelt correctly. I'm linking the Opengl32 library. I've got glext.h as an include in the program so there is no reason VC++ can't find this function. Anyone have any idea what on earth could be going on here?

Gavin
04-25-2003, 03:42 PM
is it declared in the header file?

shinpaughp
04-25-2003, 04:17 PM
Originally posted by ReAKtor:
This is a bit of a strange one. I'm trying to use OpenGL's glConvolutionFilter2D function.




glConvolutionFilter2D(GL_CONVOLUTION2D, GL_LUMINANCE, 3, 3, GL_LUMINANCE, GL_FLOAT, conv_filter2D[3][3]);


The problem is I get this error when compiling the code:




D:\Programs\OpenGL\Imaging\Imaging.cpp(186) : error C2065: 'glConvolutionFilter2D' : undeclared identifier
D:\Programs\OpenGL\Imaging\Imaging.cpp(186) : error C2065: 'GL_CONVOLUTION2D' : undeclared identifier
Error executing cl.exe.


I really don't understand it. It is spelt correctly. I'm linking the Opengl32 library. I've got glext.h as an include in the program so there is no reason VC++ can't find this function. Anyone have any idea what on earth could be going on here?

GL_CONVOLUTION2D should be GL_CONVOLUTION_2D and is defined in the glext.h header. For the function (also defined in the glext.h header), it is an extension to OpenGL v1.1 in Windows, and therefore must be set up as such. If you do not know how, check the FAQs section for extensions and how to use them.




PFNGLSOMETHINGEXTPROC glSomething = NULL;

glSomething = (PFNGLSOMETHINGEXTPROC)wglGetProcAddress("glSomethingEXT");
if (!glSomething)
{
DoError();//or do some workaround - check to see if ATI or NV extension exists with same functionality, etc
}


If you are on another platform other than Windows, you should check to see what version OpenGL is supported. You may still have to use extensions, but not for as many functions.


[This message has been edited by shinpaughp (edited 04-25-2003).]

ReAKtor
04-25-2003, 11:57 PM
Great! Thanks for your help. Those errors have now disappeared. I'm only just starting to have a play with extensions. They're one of the most exciting things about OpenGL. http://www.opengl.org/discussion_boards/ubb/smile.gif

Anywho I've now checked for the extension and got hold of it's address into a pointer called (cunningly enough) glConvolutionFilter2D.

However when I try to actually use the damn thing I get this error:




D:\Programs\OpenGL\Imaging\Imaging.cpp(191) : error C2197: 'int (__stdcall *)(void)' : too many actual parameters


I've checked it and double checked and it definitely has the correct number of parameters. Strange.

[This message has been edited by ReAKtor (edited 04-26-2003).]