PDA

View Full Version : glBlendFuncSeparate() link error



rakeshthp
03-20-2013, 05:28 AM
Hi,

I got a sample example for displaying image. In that code there is a call to a function named glBlendFuncSeperate(). After googling this I came to know that it is an API. The problem is when I try to build that code, it shows me linker error


error LNK2019: unresolved external symbol _glBendFuncSeparate at 16 (http://lists.cairographics.org/mailman/listinfo/cairo) referenced in function
error LNK2001: unresolved external symbol _glActiveTexture at 4 (http://lists.cairographics.org/mailman/listinfo/cairo)What I want to know is even after providing opengl32.lib and glu32.lib, I am getting this linking error. Which else lib file is need to get rid of this linking message?Thanks

thokra
03-20-2013, 06:20 AM
There is no such function defined in either of those two libs. Simply use one of the various extension loaders (http://www.opengl.org/wiki/OpenGL_Loading_Library) around.

rakeshthp
03-20-2013, 06:32 PM
Hi thokra,

<GL/glext.h> file is already included in that file. Is it different from these loaders..?? I found function declaration of the above two functions in this file. But definition was missing. So I was wondering how to use them.

Thanks

mbentrup
03-20-2013, 11:29 PM
opengl32.dll exports only the OpenGL 1.1 functions directly, all other functions have to be accessed via function pointers. The pointers can be retrieved by wglGetProcAddress (http://msdn.microsoft.com/de-de/library/windows/desktop/dd374386(v=vs.85).aspx).

This is obviously very tedious, so some people developed GL loader libraries that load all the function pointers for you and you can access the functions as if they were real functions.

thokra
03-21-2013, 12:46 AM
[..]as if they were real functions.

So, just because you have a fptr they aren't real functions anymore? ;)


I found function declaration of the above two functions in this file.

Exactly. But what good is an awesome function prototype without an implementation?

rakeshthp
03-21-2013, 11:12 PM
Thanks guys. I was able to solve it by including glext.h and using wglGetProcAddress. It solved the problem. :-)