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

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu