1. Function Passing

------=_NextPart_000_005C_01BEDBB5.B5E379A0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hey Rob or anyone who can help,
    I was working on a port of OpenGL, and I've run into a snag.  OpenGL
requires you to define a function for handling the displaying of data =
then
telling OpenGL what the name of the function is like so.

// C++ Pseudo-Code for OpenGL

void DispFunc(void)
{
    // Do whatever displaying you need here.
}

void main(void)
{
    glDisplayFunc(DispFunc)  // Passing the function DispFunc
                                          // as a parameter.
}

How could I mimic this in Euphoria so when I call the func =
glDisplayFunc, I
can pass it my routine.

P.S. I tried to send this directly to Rob at rds at attcanada.net and it =
said I wasn't allowed to send him mail.  I didn't know you hated me so =
much Rob :-}

Thanx ahead of time,
Adam Weeden

------=_NextPart_000_005C_01BEDBB5.B5E379A0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hey Rob or anyone who can =
help,<BR>&nbsp;&nbsp;&nbsp; I was=20
working on a port of OpenGL, and I've run into a snag.&nbsp; =
OpenGL<BR>requires=20
you to define a function for handling the displaying of data =
then<BR>telling=20
OpenGL what the name of the function is like so.</FONT></DIV>
<DIV><FONT size=3D2><BR>// C++ Pseudo-Code for OpenGL<BR><BR>void=20
DispFunc(void)<BR>{<BR>&nbsp;&nbsp;&nbsp; // Do whatever displaying you =
need=20
here.<BR>}<BR><BR>void main(void)<BR>{<BR>&nbsp;&nbsp;&nbsp;=20
glDisplayFunc(DispFunc)&nbsp; // Passing the function=20
as a parameter.<BR>}<BR><BR>How could I mimic this in Euphoria so when I =
call=20
the func glDisplayFunc, I<BR>can pass it my routine.<BR></FONT></DIV>
<DIV><FONT size=3D2>P.S. I tried to send this directly to Rob at <A=20
href=3D"mailto:rds at attcanada.net">rds at attcanada.net</A>&nbsp;and it said =
I wasn't=20
allowed to send him mail.&nbsp; I didn't know you hated me so much Rob=20
:-}</FONT></DIV>
<DIV><FONT size=3D2><BR>Thanx ahead of time,<BR>Adam=20

------=_NextPart_000_005C_01BEDBB5.B5E379A0--

________________________________________________________
NetZero - We believe in a FREE Internet.  Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download/index.html

new topic     » topic index » view message » categorize

2. Re: Function Passing

Adam Weeden writes:
> // C++ Pseudo-Code for OpenGL
>
> void DispFunc(void)
> {
>     // Do whatever displaying you need here.
> }
>
> void main(void)
> {
>    glDisplayFunc(DispFunc)  // Passing the function DispFunc
>                                          // as a parameter.
> }

> How could I mimic this in Euphoria...

*** warning - untested code ahead:

1. Define function DispFunc() in Euphoria code
    as a function of 0 parameters.
     It has to be function - just return 0 or something.
    The returned value will be ignored.

2. Get the address of this Euphoria function with:
           atom addr
           addr = call_back(routine_id("DispFunc"))

3. link to glDisplayFunc using
        lib = open_dll("....")
       gld = define_c_proc(lib, "glDisplayFunc", {C_POINTER}).

4. Call glDisplayFunc() using:
       c_proc(gld, {})

> P.S. I tried to send this directly to Rob at rds at attcanada.net
> and it said I wasn't allowed to send him mail.  I didn't
> know you hated me so much Rob :-}

My ISP's mail server was down today for a few hours.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Function Passing

> 4. Call glDisplayFunc() using:
>       c_proc(gld, {})

should be:
          c_proc(gld, {addr})

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu