Advertisement
adwas33

Untitled

Mar 16th, 2022
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. void figura(int points,int vbo ) {
  2. if (points < 0)return;
  3. GLfloat* vertices = new GLfloat[points * 6];
  4. float alfa = 0.0;
  5. float pom = 2 * M_PI / points; //360st/points - odleglosci punktów
  6. float R = 0.5; //promień
  7. float** colors = new float* [points];
  8. for (int i = 0; i < points * 6; i += 6) {
  9. vertices[i] = R * cos(alfa); //x
  10. vertices[i + 1] = R * sin(alfa); //y
  11. vertices[i + 2] = 0; //z
  12. vertices[i + 3] = (cos(alfa) + 1) / 1.5; //ustawienie kolorów RGB
  13. vertices[i + 4] = (cos(alfa) + 1)
  14. vertices[i + 4] = (cos(alfa) + 1) / 1.5;
  15. vertices[i + 5] = (sin(alfa) + 1) / 1.5;
  16. alfa = alfa + pom; //zmiana kąta alfa poprzez dodanie 360stopni/ilosc
  17. wierzchołków
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement