May 17, 2024, 04:25:09 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


more conversion help?

Started by ZeroDog, October 03, 2009, 01:16:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ZeroDog

i have this code I have to convert:
#define _ASSERT(a) assert(a)

static void APIENTRY InitBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
void *extproc;

extproc = (void *) wglGetProcAddress("glBlendColor");

if (extproc == NULL) {
_ASSERT(0);
return;
}

glBlendColor = extproc;

glBlendColor(red, green, blue, alpha);
}



I understand the theory behind the code, I'm just not sure how to implement in EBasic. 

Basically, the API functions are not always at the same location in the DLL.  The wglGetProcAddress function is used to get the location of the function in the DLL.  What I am having trouble with is now applying the newly gotten address to the function I have already declared.  How can I specify the address I receive from wglGetProcAddress to a function (template) that I declare? 




sapero

' prototype: declare PFNGLBLENDCOLORPROC(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)

sub InitBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)

UINT glBlendColor = wglGetProcAddress("glBlendColor")

if (glBlendColor) then !<PFNGLBLENDCOLORPROC>glBlendColor(red, green, blue, alpha)
endsub

ZeroDog

Thanks... I think I see what I have to do now.   :)