We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › types mismatch using processing & eclipse
Page Index Toggle Pages: 1
types mismatch using processing & eclipse (Read 807 times)
types mismatch using processing & eclipse
Feb 5th, 2010, 1:59pm
 
Hi there, i am new to Processing and experienced a strange problem. I've tried to write processing code in Eclipse (from the 3D example):
Code:
camera(30.0, mouseY, 220.0, // eyeX, eyeY, eyeZ
0.0, 0.0, 0.0, // centerX, centerY, centerZ
0.0, 1.0, 0.0); // upX, upY, upZ

Got an error:
The method camera(float, float, float, float, float, float, float, float, float) in the type PApplet is not applicable for the arguments (void, int, double, double, double, double, double, double, double)
It can be easily solved:
Code:
camera((float)30.0, (float)mouseY, (float)220.0, // eyeX, eyeY, eyeZ
(float)0.0, (float)0.0, (float)0.0, // centerX, centerY, centerZ
(float)0.0, (float)1.0, (float)0.0); // upX, upY, upZ

My question is why do i have to cast types while writing in eclipse? In processing IDE the first code works well.
Re: types mismatch using processing & eclipse
Reply #1 - Feb 5th, 2010, 2:22pm
 
The camera() method expected float as parameter but 220.0 is an double in  java. In processing there are happen some hidden things when you start your sketch, converting 220.0 into 220.0f for example. So in eclipse you ever have to add an 'f' add the end of your floating point number to get JAVA know its an float and not an double.
Page Index Toggle Pages: 1