JoeyDeVries / LearnOpenGL

Code repository of all OpenGL chapters from the book and its accompanying website https://learnopengl.com
https://learnopengl.com
Other
11.1k stars 2.81k forks source link

Minor error in renderSphere #365

Open Camouflager opened 1 year ago

Camouflager commented 1 year ago

For some reason I was going through sphere code, and I found that there's a minor error.

Here's how the positions are generated: https://github.com/JoeyDeVries/LearnOpenGL/blob/3e94252892660902bef62068c35253cbe3464c9b/src/6.pbr/1.1.lighting/lighting.cpp#L265-L271

Here's how the indices for the triangle strips were generated: https://github.com/JoeyDeVries/LearnOpenGL/blob/3e94252892660902bef62068c35253cbe3464c9b/src/6.pbr/1.1.lighting/lighting.cpp#L284-L302

However this does not work when X_SEGMENTS != Y_SEGMENTS. It currently only works because x and y are interchangeable.

let X_SEGMENTS=32 we get the following result:

image

I'm a big fan of this website and I hope it gets better in the future. I hope this issue helps.