wishkah353
09-24-2008, 12:55 PM
error: possible loss of precision
found: double
required: float
float y = radius * Math.sin( i * twoPi / sections );
---------------^
whyyyyyyyyyyyyyyyyyyyyyyyy? i've tried changing the variable to every last type of number i could find and nothings working =(
public void display (GLAutoDrawable drawable) {
final GL gl = drawable.getGL ();
float i;
float sections = (float)(16);
float radius = (float)(0.8f); //radius
float twoPi = (float)(2.0f * 3.14159f);
gl.glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
gl.glClear ( GL.GL_COLOR_BUFFER_BIT );
gl.glColor3f ( 1.0f, 1.0f, 1.0f );
gl.glBegin ( GL.GL_TRIANGLE_FAN );
gl.glVertex2f ( 0.0f, 0.0f );
for( i = 0; i <= sections; i++ ) {
float x = radius * Math.cos(i * twoPi / sections);
float y = radius * Math.sin(i * twoPi / sections);
gl.glVertex2f ( x, y );
}
found: double
required: float
float y = radius * Math.sin( i * twoPi / sections );
---------------^
whyyyyyyyyyyyyyyyyyyyyyyyy? i've tried changing the variable to every last type of number i could find and nothings working =(
public void display (GLAutoDrawable drawable) {
final GL gl = drawable.getGL ();
float i;
float sections = (float)(16);
float radius = (float)(0.8f); //radius
float twoPi = (float)(2.0f * 3.14159f);
gl.glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
gl.glClear ( GL.GL_COLOR_BUFFER_BIT );
gl.glColor3f ( 1.0f, 1.0f, 1.0f );
gl.glBegin ( GL.GL_TRIANGLE_FAN );
gl.glVertex2f ( 0.0f, 0.0f );
for( i = 0; i <= sections; i++ ) {
float x = radius * Math.cos(i * twoPi / sections);
float y = radius * Math.sin(i * twoPi / sections);
gl.glVertex2f ( x, y );
}