214215216217218219220221222223224
float cx = center.x; float cy = center.y; gl.glBegin(GL2.GL_TRIANGLE_FAN); gl.glColor4f(color.x, color.y, color.z, .4f); for (int i = 0; i < NUM_CIRCLE_POINTS; i++) { gl.glVertex3f(x + cx, y + cy, 0); // apply the rotation matrix float temp = x; x = c * x - s * y; y = s * temp + c * y; }
224225226227228229230231232233234
} gl.glEnd(); gl.glBegin(GL2.GL_LINE_LOOP); gl.glColor4f(color.x, color.y, color.z, 1); for (int i = 0; i < NUM_CIRCLE_POINTS; i++) { gl.glVertex3f(x + cx, y + cy, 0); // apply the rotation matrix float temp = x; x = c * x - s * y; y = s * temp + c * y; }
232233234235236237238239240241242
x = c * x - s * y; y = s * temp + c * y; } gl.glEnd(); gl.glBegin(GL2.GL_LINES); gl.glVertex3f(cx, cy, 0); gl.glVertex3f(cx + axis.x * radius, cy + axis.y * radius, 0); gl.glEnd(); gl.glPopMatrix(); }
233234235236237238239240241242243
y = s * temp + c * y; } gl.glEnd(); gl.glBegin(GL2.GL_LINES); gl.glVertex3f(cx, cy, 0); gl.glVertex3f(cx + axis.x * radius, cy + axis.y * radius, 0); gl.glEnd(); gl.glPopMatrix(); } @Override
245246247248249250251252253254255
GL2 gl = panel.getGL().getGL2(); gl.glPushMatrix(); transformViewport(gl, zero); gl.glBegin(GL2.GL_LINES); gl.glColor3f(color.x, color.y, color.z); gl.glVertex3f(p1.x, p1.y, 0); gl.glVertex3f(p2.x, p2.y, 0); gl.glEnd(); gl.glPopMatrix(); }
246247248249250251252253254255256
gl.glPushMatrix(); transformViewport(gl, zero); gl.glBegin(GL2.GL_LINES); gl.glColor3f(color.x, color.y, color.z); gl.glVertex3f(p1.x, p1.y, 0); gl.glVertex3f(p2.x, p2.y, 0); gl.glEnd(); gl.glPopMatrix(); } @Override
276277278279280281282283284285286
} else { ParticleColor color = colors[i]; gl.glColor4b(color.r, color.g, color.b, color.a); } for (int j = 0; j < NUM_CIRCLE_POINTS; j++) { gl.glVertex3f(x + cx, y + cy, 0); float temp = x; x = c * x - s * y; y = s * temp + c * y; } gl.glEnd();
312313314315316317318319320321322
} else { ParticleColor color = colors[i]; gl.glColor4b(color.r, color.g, color.b, (byte) 127); } for (int j = 0; j < NUM_CIRCLE_POINTS; j++) { gl.glVertex3f(x + cx, y + cy, 0); float temp = x; x = c * x - s * y; y = s * temp + c * y; } gl.glEnd();
271272273274275276277278279280281
gl.glBegin(GL_LINES); // X-Axis gl.glColor3f( 1, 0, 0 ); gl.glVertex3f( 0, 0, 0 ); gl.glVertex3f( 50, 0, 0 ); // Y-Axis gl.glColor3f( 0, 1, 0 ); gl.glVertex3f( 0, 0, 0 );
272273274275276277278279280281282
gl.glBegin(GL_LINES); // X-Axis gl.glColor3f( 1, 0, 0 ); gl.glVertex3f( 0, 0, 0 ); gl.glVertex3f( 50, 0, 0 ); // Y-Axis gl.glColor3f( 0, 1, 0 ); gl.glVertex3f( 0, 0, 0 ); gl.glVertex3f( 0, 50, 0 );