Re: Passing floats/doubles to C

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

On Sun, 13 Feb 2000 16:27:26 -0600, Todd Riggins <triggins at AIRMAIL.NET>
wrote:

>Now I update my C structure through my dll function.
>this is my C structure:
>
>typedef struct tagMATERIAL
>{
>        float diffuse_r;
>        float diffuse_g;
>        float diffuse_b;
>        float diffuse_a;
>        float ambient_r;
>        float ambient_g;
>        float ambient_b;
>        float ambient_a;
>        float specular_r;
>        float specular_g;
>        float specular_b;
>        float specular_a;
>        float emissive_r;
>        float emissive_g;
>        float emissive_b;
>        float emissive_a;
>        float power;
>} MATERIAL;
>

Todd:
     I am confused you said that you were using doubles and
     in your last post you are using float ??

     double and float are both floating point numbers but
     they are different size numbers.

     Also in your Sets function you are setting the same names
     more than once.

>Fill in the values:
>  Sets(material, "duffuse_r",  1.0) <-------- same name
>  Sets(material, "duffuse_r",  1.1) <-------- same name
>  Sets(material, "duffuse_r",  1.2) <-------- same name
>  Sets(material, "duffuse_r",  1.3) <-------- last value you set
>  Sets(material, "ambient_r",  1.4) ETC....
>  Sets(material, "ambient_r",  1.5)
>  Sets(material, "ambient_r",  1.6)
>  Sets(material, "ambient_r",  1.7)
>  Sets(material, "specular_r", 1.8)
>  Sets(material, "specular_r", 1.9)
>  Sets(material, "specular_r", 1.11)
>  Sets(material, "specular_r", 1.12)
>  Sets(material, "emissive_r", 1.13)
>  Sets(material, "emissive_r", 1.14)
>  Sets(material, "emissive_r", 1.15)
>  Sets(material, "emissive_r", 1.16)
>  Sets(material, "power",      1.17)

>Now I get these values when I print out each member of my structure
>in the same order as your structure:
>1.300000    <-- the last thing you set this to was 1.3
>0.000000
>0.000000
>0.000000
>1.700000


 In other words It is working if you correct the Sets function names.

Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu