I wasnt sure of posting this here, since it is a very basic question, but it is math related so I guess it would be better to post it here.
I have to finish an OpenGL project for college, and my deadline is tomorrow at midnight, I have tried everything and can’t find the solution.
I have to display a surface of revolution and add some lights (the surface of revolution happens to be a windmill), my classmates chose other objects such as hands or simple robots that were easier to light, so they couldn’t help me.
My problem is about calculating the normal vectors of the surface.
The surface is drawn as follows
GLfloat top(GLfloat u)
return (float)height - (u*u);
The teacher told me to calculate the normals by using the vector product of the partial derivatives of the ecuation.
I wrote this
t1 = topd(u)Rsin(v2PI);
t1 = 3R;
t1 = topd(u)Rcos(v2*PI);
t2 = 2PI * R * top(u) * cos(v2PI);
t2 = 0;
t2 = -Rtop(u)2PIsin(v2*PI);
Where topd() is
GLfloat inline topd(GLfloat u)
When i render it, almost the 90% of the object is completely white, and just a very small zone is shaded.
The teacher says that there is something wrong with the normal vectors, but I am completely clueless now.
Any help woulde be really appreciated