I was wondering how I could takes each sphere’s vertex stored in my buffer, and calculate the normal to each of them separately. Is it possible to do it in OpenGL?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
OpenGL is typically used to render meshes, not compute them. And normals are part of a mesh’s data. It is usually the responsibility of the builder of the mesh to supply normals.
In the case of a sphere, normals are dead simple to compute perfectly. For a given vector position P on the sphere who’s center is C, the normal is
norm(P - C), wherenormnormalizes the vector.