commit e0817a497de67eac9cf6389e02e3cc2a0f22c8d4
parent e356e8fe3826e5448b282eb3f791bb2dcf70fc22
Author: bsandro <email@bsandro.tech>
Date: Sun, 23 Nov 2025 21:49:02 +0200
sphere cleaned
Diffstat:
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/sphere.c b/sphere.c
@@ -26,6 +26,10 @@ x;
} \
}
+// I can push that to the local variables but want to keep the array on stack for now.
+#define STACKS 24
+#define SECTORS 24
+
static const double current_ts() {
struct timespec ts;
timespec_get(&ts, TIME_UTC);
@@ -187,14 +191,12 @@ int main(int argc, char *argv[]) {
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
-#define stacks 24
-#define sectors 24
- const float radius = 1.1f;
+ const float radius = .9f;
// x,y,z
- GLfloat vertices[(stacks+1)*(sectors+1)*3];
- GLuint elements[(stacks-1)*sectors*6];
- generateSphere(radius, stacks, sectors, vertices);
- generateElements(stacks, sectors, elements);
+ GLfloat vertices[(STACKS+1)*(SECTORS+1)*3];
+ GLuint elements[(STACKS-1)*SECTORS*6];
+ generateSphere(radius, STACKS, SECTORS, vertices);
+ generateElements(STACKS, SECTORS, elements);
printf("%4lu vertices\n%4lu elements\n", LEN(vertices), LEN(elements));