Kiosani

RenderBitmapCircle (funcion para cargar Texturas Cuadradas como Circulos Perfectos en pantalla)

Mar 13th, 2022 (edited)
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. void RenderBitmapCircle(int Texture, float x, float y, float Radius)
  2. {
  3. float tx, ty;
  4.  
  5. float xcos, ysin;
  6.  
  7. float Angle, Radian;
  8.  
  9. BindTexture(Texture);
  10.  
  11. glBegin(GL_POLYGON);
  12.  
  13. for(Angle=0.0;Angle<=360.0;Angle+=2.0)
  14. {
  15. Radian = Angle * (Q_PI/180.0f);
  16.  
  17. xcos = cosf(Radian);
  18. ysin = sinf(Radian);
  19.  
  20. x = xcos * Radius + x;
  21. y = ysin * Radius + y;
  22.  
  23. tx = xcos * 0.5f + 0.5f;
  24. ty = ysin * 0.5f + 0.5f;
  25.  
  26. glTexCoord2f(tx, ty);
  27. glVertex2f(x, y);
  28. }
  29.  
  30. glEnd();
  31. }
Add Comment
Please, Sign In to add comment