1. Morfit or not to Morfit, that is the question

Hello everyone,

 Longlifter has bascially inspired me to get the MORFIT 3D SDK
working with Euphoria by directing me to the MORFIT's website.
There's alot of neat things you can do with MORFIT to make
a 3D game. It also includes a World Builder and a Terrain Builder
utilities to help you make a 3D World faster. Plus, whenever
you make a cool 3D game with Morfit, they will advertize your
game on the internet where you can make 33% of the profits for what
ever the game sells for.

 I was wondering if anyone else would be also interested in a
3D engine SDK for Euphoria like this???

At this time, with the help of David Cuny's Win32Lib, I finally
got Morfit to draw it's graphics on to the window. But there are
Morfit functions that are important to use in order to use this
API correctly, but I am unable to code it in Euphoria without
it giving me an Application Error pop-up stating: The instruction
at 10073b4 referanced memory at ffffffff. The memory could not be
read from. ( I do understand the "basics" of that problem)

From the morfit.dll, I need to call this 'c' function:

void Morfit_camera_get_location(DWORD camera_handle, double *x, double
*y, double *z);

I would think I would need to code it in euphoria like this:

Morfit_camera_get_location =
link_c_proc(morfit,"Morfit_camera_get_location",{C_ULONG, C_POINTER,
C_POINTER, C_POINTER})

In "c", the Morfit_camera_get_location expects the x,y and z params
to be the address locations of x,y and z. Like in 'c', I would put
 &x, &y, &z respectivly to referance the address location of these
varables.
Two issues here: First, as I look in the Euphoria Docs, I see that
C_POINTER = C_ULONG. But as you see above, the 'c' params are a
pointer to a DOUBLE varable. So, if I could use C_POINTER, I would
loose 32 bits of info since a DOUBLE is 64 bits, right?
Second, I remember the topic of 'returning the address of an atom'
have been brought up before on the mailing list. I've searched
the mailing list archives about it, and didn't find any answer
on how to do it.

So, How do you return the address of an atom?

---------

Longlifter, I know you had origanlly asked for help on helping you
to get Morfit to work with Euphoria. I'm not trying to 'steal' this
project behind your back. Ofcoarse, if you would like me to, I would
be glad to try to complete the project to the end. As you see what
I have written above, there are issues with translating 'c' functions
in the morfit.dll that seem to me that making a full Euphoria program
with Morfit not possible unless someone can help me solve them.
So, If the above problem can be solve, I'll send you what I have so
you can complete the project and try to help you with whatever problems
that you might need. Also, you have asked me for help with Exotica
problems you're having and I am about to write stuff for you to help you
out with that. Have you figured the Exotica problems out yet, or do you
still need help on that?

-- Todd Riggins

new topic     » topic index » view message » categorize

2. Re: Morfit or not to Morfit, that is the question

For pointers, you have to pass the address of the data in memory. You can
allocate data using allocate(). For a 64-bit double value, for example, you
can use:

include machine.e
function allocateDouble(atom value)
    atom a
    a = allocate(8)
    poke(a,atom_to_float64(value))
    return a
end function

Then you can call it like this:
atom x, y, z, camera_handle
x = allocateDouble(1)
y = allocateDouble(2)
z = allocateDouble(3)

If that doesn't work, try changing
Morfit_camera_get_location =
link_c_proc(morfit,"Morfit_camera_get_location",{C_ULONG, C_POINTER,
C_POINTER, C_POINTER})

to

Morfit_camera_get_location =
link_c_proc(morfit,"Morfit_camera_get_location",{C_LONG, C_POINTER,
C_POINTER, C_POINTER})

I don't know whether that will help, but you could always try it.

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

EUPHORIA at LISTSERV.MUOHIO.EDU wrote:

> Hello everyone,
>
>  Longlifter has bascially inspired me to get the MORFIT 3D SDK
> working with Euphoria by directing me to the MORFIT's website.
> There's alot of neat things you can do with MORFIT to make
> a 3D game. It also includes a World Builder and a Terrain Builder
> utilities to help you make a 3D World faster. Plus, whenever
> you make a cool 3D game with Morfit, they will advertize your
> game on the internet where you can make 33% of the profits for what
> ever the game sells for.
>
>  I was wondering if anyone else would be also interested in a
> 3D engine SDK for Euphoria like this???
>
> At this time, with the help of David Cuny's Win32Lib, I finally
> got Morfit to draw it's graphics on to the window. But there are
> Morfit functions that are important to use in order to use this
> API correctly, but I am unable to code it in Euphoria without
> it giving me an Application Error pop-up stating: The instruction
> at 10073b4 referanced memory at ffffffff. The memory could not be
> read from. ( I do understand the "basics" of that problem)
>
> >From the morfit.dll, I need to call this 'c' function:
>
> void Morfit_camera_get_location(DWORD camera_handle, double *x, double
> *y, double *z);
>
> I would think I would need to code it in euphoria like this:
>
> Morfit_camera_get_location =
> link_c_proc(morfit,"Morfit_camera_get_location",{C_ULONG, C_POINTER,
> C_POINTER, C_POINTER})
>
> In "c", the Morfit_camera_get_location expects the x,y and z params
> to be the address locations of x,y and z. Like in 'c', I would put
>  &x, &y, &z respectivly to referance the address location of these
> varables.
> Two issues here: First, as I look in the Euphoria Docs, I see that
> C_POINTER = C_ULONG. But as you see above, the 'c' params are a
> pointer to a DOUBLE varable. So, if I could use C_POINTER, I would
> loose 32 bits of info since a DOUBLE is 64 bits, right?
> Second, I remember the topic of 'returning the address of an atom'
> have been brought up before on the mailing list. I've searched
> the mailing list archives about it, and didn't find any answer
> on how to do it.
>
> So, How do you return the address of an atom?
>
> ---------
>
> Longlifter, I know you had origanlly asked for help on helping you
> to get Morfit to work with Euphoria. I'm not trying to 'steal' this
> project behind your back. Ofcoarse, if you would like me to, I would
> be glad to try to complete the project to the end. As you see what
> I have written above, there are issues with translating 'c' functions
> in the morfit.dll that seem to me that making a full Euphoria program
> with Morfit not possible unless someone can help me solve them.
> So, If the above problem can be solve, I'll send you what I have so
> you can complete the project and try to help you with whatever problems
> that you might need. Also, you have asked me for help with Exotica
> problems you're having and I am about to write stuff for you to help you
> out with that. Have you figured the Exotica problems out yet, or do you
> still need help on that?
>
> -- Todd Riggins

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

3. Re: Morfit or not to Morfit, that is the question

Hi,

Jeffrey Fielding wrote:
> function allocateDouble(atom value)
>     atom a
>     a = allocate(8)
>     poke(a,atom_to_float64(value))
>     return a
> end function

That did the trick. The atom_to_float64() was the thing I was definetly
overlooking. I can't believe I asked about how to return an address
after I've been using it in the Exotica api. I keep thinking in
'c' terms instead of Euphoria terms.
Enough excusses, thanks for showing me that function. :)

-- Todd Riggins

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

4. Re: Morfit or not to Morfit, that is the question

Hi!  I know you are not trying to steal my idea.  I didn't think of it as a
project.  I only wanted to bring Morfit's great quality and advantages for
making a great 3D game into the Euphoria language.  I asked the webmaster
how I should go about imorting Morift to Euphoria because of it's simplicity
for some(hint hint).

I wanted everyone who has some or great knowledge of windows and C
programming to port Morfit to Euphoria.  By all means I want you to try and
complete this project as well as anyone else who wants to join in.  I want
everyone who has Euphoria to be able to benefit from Morfit, not just
myself.  Keep up all the great work you are doing on the project and keep us
informed.

P.S.  I still need help with Exotica and thanks for all of your and all
other contributors help.  When and If this Morfit project is completed I
will submit it and the proper credits to the webmaster.  Who knows how he'll
react.
----- Original Message -----
From: "triggins" <triggins at AIRMAIL.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, December 26, 1999 7:25 PM
Subject: Morfit or not to Morfit, that is the question


> Hello everyone,
>
>  Longlifter has bascially inspired me to get the MORFIT 3D SDK
> working with Euphoria by directing me to the MORFIT's website.
> There's alot of neat things you can do with MORFIT to make
> a 3D game. It also includes a World Builder and a Terrain Builder
> utilities to help you make a 3D World faster. Plus, whenever
> you make a cool 3D game with Morfit, they will advertize your
> game on the internet where you can make 33% of the profits for what
> ever the game sells for.
>
>  I was wondering if anyone else would be also interested in a
> 3D engine SDK for Euphoria like this???
>
> At this time, with the help of David Cuny's Win32Lib, I finally
> got Morfit to draw it's graphics on to the window. But there are
> Morfit functions that are important to use in order to use this
> API correctly, but I am unable to code it in Euphoria without
> it giving me an Application Error pop-up stating: The instruction
> at 10073b4 referanced memory at ffffffff. The memory could not be
> read from. ( I do understand the "basics" of that problem)
>
> From the morfit.dll, I need to call this 'c' function:
>
> void Morfit_camera_get_location(DWORD camera_handle, double *x, double
> *y, double *z);
>
> I would think I would need to code it in euphoria like this:
>
> Morfit_camera_get_location =
> link_c_proc(morfit,"Morfit_camera_get_location",{C_ULONG, C_POINTER,
> C_POINTER, C_POINTER})
>
> In "c", the Morfit_camera_get_location expects the x,y and z params
> to be the address locations of x,y and z. Like in 'c', I would put
>  &x, &y, &z respectivly to referance the address location of these
> varables.
> Two issues here: First, as I look in the Euphoria Docs, I see that
> C_POINTER = C_ULONG. But as you see above, the 'c' params are a
> pointer to a DOUBLE varable. So, if I could use C_POINTER, I would
> loose 32 bits of info since a DOUBLE is 64 bits, right?
> Second, I remember the topic of 'returning the address of an atom'
> have been brought up before on the mailing list. I've searched
> the mailing list archives about it, and didn't find any answer
> on how to do it.
>
> So, How do you return the address of an atom?
>
> ---------
>
> Longlifter, I know you had origanlly asked for help on helping you
> to get Morfit to work with Euphoria. I'm not trying to 'steal' this
> project behind your back. Ofcoarse, if you would like me to, I would
> be glad to try to complete the project to the end. As you see what
> I have written above, there are issues with translating 'c' functions
> in the morfit.dll that seem to me that making a full Euphoria program
> with Morfit not possible unless someone can help me solve them.
> So, If the above problem can be solve, I'll send you what I have so
> you can complete the project and try to help you with whatever problems
> that you might need. Also, you have asked me for help with Exotica
> problems you're having and I am about to write stuff for you to help you
> out with that. Have you figured the Exotica problems out yet, or do you
> still need help on that?
>
> -- Todd Riggins

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

5. Re: Morfit or not to Morfit, that is the question

Hiyas,

Thanks to Jeffery for pointing out how I can return the address
of a DOUBLE atom.

I'm still wondering about the C_POINTER when passing the address of
my DOUBLE sized atom through a 'c' dll function.

--------
The 'c' function:

void Morfit_camera_get_location(DWORD camera_handle, double *x, double
*y, double *z);
--------
My Euphoria translation:

Morfit_camera_get_location =
link_c_proc(morfit,"Morfit_camera_get_location",{C_ULONG, C_POINTER,
C_POINTER, C_POINTER})
--------

Seeing in the Euphoria Docs that C_POINTER = C_ULONG,
when I pass my DOUBLE atom through , let's say, the double *x of the
Morfit_camera_get_location function, is it goung to pass 4 bytes of
my DOUBLE atom( in which I'm afraid of it's doing) or is it going
to pass the full 8 bytes?

Sorry for my ignorance here, but I need to get this straight in my
brain cells that I still have left.
Thanks in advance...

-- Todd Riggins

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

6. Re: Morfit or not to Morfit, that is the question

The "C" pointer ( 4 bytes ) is the address location of the

  type double which contains the 8 bytes.

  In other words you are telling "C" where to look for the double value

  not passing it the value.

Bernie

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

7. Re: Morfit or not to Morfit, that is the question

Okay, thanks for clearing that up for me... I see now...

-- Todd Riggins

Bernie Ryan wrote:
>
> The "C" pointer ( 4 bytes ) is the address location of the
>
>   type double which contains the 8 bytes.
>
>   In other words you are telling "C" where to look for the double value
>
>   not passing it the value.
>
> Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu