Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void drawFilledCircle(int xx, int yy, float radius, Color col) {
- int sections = 50;
- double dAngle = 2 * Math.PI / sections;
- float x, y;
- glPushMatrix();
- glEnable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_LINE_SMOOTH);
- glBegin(GL_TRIANGLE_FAN);
- for (int i = 0; i < sections; i++) {
- x = (float) (radius * Math.sin((i * dAngle)));
- y = (float) (radius * Math.cos((i * dAngle)));
- glColor4f(col.getRed() / 255f, col.getGreen() / 255f, col.getBlue() / 255f, col.getAlpha() / 255f);
- glVertex2f(xx + x, yy + y);
- }
- GlStateManager.color(0, 0, 0);
- glEnd();
- glEnable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
- glPopMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement