PDA

View Full Version : Example of using "glBlendEquation"



gorl
05-26-2005, 05:06 PM
I'm looking for any example of source code where is used subroutine glBlendEquation. Thank's for any help. Sorry for my English :(

dvm
05-26-2005, 06:48 PM
Did you search google? Or the red book? I'm sure you can find its code somewhere (probably in this site too). Also nehe (http://nehe.gamedev.net) has a lot of tutorials. Maybe it's used in there somewhere.

gorl
05-27-2005, 11:30 AM
Yes I did but I couldn't find. In i "glext.h" :

#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlendEquation (GLenum);

glBlendEquation is not declare as pointer, how I should load this function ??

Overmind
05-27-2005, 11:42 PM
See this thread:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000767

It talks about using shaders, but the same applies to every other extension or post-1.1 function.

gorl
05-28-2005, 09:14 AM
Your way is correct. But you use a function pointer. I can declare glBlendEquation as a pointer :

PFNGLBLENDEQUATIONEXTPROC glBlendEquation = NULL;

and load it using wglGetProcAddress("glBlendEquation").
Is there any other possibility, using declaration in "glext.h" ??

Overmind
05-29-2005, 04:16 AM
I wouldn't recommend it, but on Linux you can #define GL_GLEXT_PROTOTYPES before including "glext.h", then you should be able to just use it.

But then your program will not work at all on systems that don't support this function, it will just fail to start without any chance for you to use a fallback path or at least print a user friendly error message...

This method will also not work on Windows, and I don't know if it will work on Mac. Bypassing the extension loading mechanism should not be done because it is not portable.

If you're looking for an easy way to load the function pointers, look for an extension loading library like glew.

gorl
05-29-2005, 02:03 PM
That explains a lot :) . Thank You for help.