Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public static void drawFilledCircle(int xx, int yy, float radius, Color col) {
  2. int sections = 50;
  3. double dAngle = 2 * Math.PI / sections;
  4. float x, y;
  5.  
  6. glPushMatrix();
  7. glEnable(GL_BLEND);
  8. glDisable(GL_TEXTURE_2D);
  9. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  10. glEnable(GL_LINE_SMOOTH);
  11. glBegin(GL_TRIANGLE_FAN);
  12.  
  13. for (int i = 0; i < sections; i++) {
  14. x = (float) (radius * Math.sin((i * dAngle)));
  15. y = (float) (radius * Math.cos((i * dAngle)));
  16.  
  17. glColor4f(col.getRed() / 255f, col.getGreen() / 255f, col.getBlue() / 255f, col.getAlpha() / 255f);
  18. glVertex2f(xx + x, yy + y);
  19. }
  20. GlStateManager.color(0, 0, 0);
  21. glEnd();
  22. glEnable(GL_TEXTURE_2D);
  23. glDisable(GL_BLEND);
  24. glDisable(GL_LINE_SMOOTH);
  25. glPopMatrix();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement