Note that there are some explanatory texts on larger screens.

plurals
  1. PORotating Sphere with Texture iOS
    primarykey
    data
    text
    <p>I know its very basic question but i couldn't find the answer i am looking for. Basically i have to display a rotating 3D sphere on camera overlay. I have got everything except applying texture to that sphere. Here is my code which generate the triangles strips. </p> <pre><code>int createSphere (GLfloat spherePoints[], GLfloat fRadius, GLfloat step){ int points = 0; GLfloat uStep = DEGREES_TO_RADIANS (step); GLfloat vStep = uStep; for (GLfloat u = 0.0f; u &lt;= (2 * M_PI); u += uStep) { for (GLfloat v = -M_PI_2; v &lt;= M_PI_2; v += vStep) { points++; spherePoints[(points - 1) * 3] = fRadius * cosf(v) * cosf(u); // x spherePoints[((points - 1) * 3) + 1] = fRadius * cosf(v) * sinf(u); // y spherePoints[((points - 1) * 3) + 2] = fRadius * sinf(v); // z points++; spherePoints[(points - 1) * 3] = fRadius * cosf(v) * cosf(u + uStep); // x spherePoints[((points - 1) * 3) + 1] = fRadius * cosf(v) * sinf(u + uStep); // y spherePoints[((points - 1) * 3) + 2] = fRadius * sinf(v); // z points++; spherePoints[(points - 1) * 3] = fRadius * cosf(v + vStep) * cosf(u); // x spherePoints[((points - 1) * 3) + 1] = fRadius * cosf(v + vStep) * sinf(u); // y spherePoints[((points - 1) * 3) + 2] = fRadius * sinf(v + vStep); // z points++; spherePoints[(points - 1) * 3] = fRadius * cosf(v + vStep) * cosf(u + uStep); // x spherePoints[((points - 1) * 3) + 1] = fRadius * cosf(v + vStep) * sinf(u + uStep); // y spherePoints[((points - 1) * 3) + 2] = fRadius * sinf(v + vStep); // z } } return points; } </code></pre> <p>Can anybody explain how to generate the Texture coordinates and Normals?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload