opengl_x11

Playing with OpenGL
git clone git://bsandro.tech/opengl_x11
Log | Files | Refs | README | LICENSE

commit 24019d11af4bdbfd14da099f2a4aa9d5d43883ab
parent 32fffec98c6be4a6a302f39bd99dc72863718ce1
Author: bsandro <email@bsandro.tech>
Date:   Sun, 23 Nov 2025 16:04:31 +0200

sphere (dotted)

Diffstat:
Msphere.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sphere.c b/sphere.c @@ -115,7 +115,7 @@ void generateSphere(float radius, int stacks, int sectors, GLfloat outVertices[] for (int i=0;i<=stacks;++i) { float stackAngle = M_PI_2 - (float)i*stackStep; float xy = radius*cosf(stackAngle); - float z = radius = sinf(stackAngle); + float z = sinf(stackAngle); for (int j=0;j<=sectors;++j) { float sectorAngle = (float)j*sectorStep; float x = xy*cosf(sectorAngle); @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) { #define sectors 50 // x,y,z GLfloat vertices[(stacks+1)*(sectors+1)*3]; - generateSphere(10.f, stacks, sectors, vertices); + generateSphere(1.f, stacks, sectors, vertices); // vec3 positions[1] = {{0,0,0}}; @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) { glm_mat4_identity(view); glm_translate(view, (vec3){0.f, 0.f, -3.f}); mat4 projection; - glm_perspective(glm_rad(55.f), 4.f/3.f, 0.1f, 100.f, projection); + glm_perspective(glm_rad(45.f), 4.f/3.f, 0.1f, 100.f, projection); glm_mat4_print(model, stdout); glm_mat4_print(view, stdout);