Hey, I have a sphere in my game world and i would like to place a plane at each vertex on this sphere for debugging purposes. The planes should be orientated so that they lie flat against the sphere (perpendicular to the normals). The sphere is located at the origin, so all the vertices are relative开发者_运维问答 to that.
If my thinking is correct, i should be able to do this using the positions of the vertices and some simple trigonometry. I have tried a few combinations but have had no joy yet. I would greatly appreciate some help on this. Thanks.
Here is my code:
float xRot = RADIANS_TO_DEGREES(sinf(vertex.x/PLANET_RADIUS));
float yRot = RADIANS_TO_DEGREES(cosf(vertex.y/PLANET_RADIUS));
glRotatef(xRot, 1.0, 0, 0);
glRotatef(yRot, 0, 1.0, 0);
精彩评论