IonicWind Software

IWBasic => General Questions => Topic started by: ZeroDog on October 03, 2009, 01:16:53 PM

Title: more conversion help?
Post by: ZeroDog on October 03, 2009, 01:16:53 PM
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? 



Title: Re: more conversion help?
Post by: sapero on October 03, 2009, 01:52:20 PM
' 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
Title: Re: more conversion help?
Post by: ZeroDog on October 04, 2009, 09:19:02 PM
Thanks... I think I see what I have to do now.   :)