Skip to content

Instantly share code, notes, and snippets.

@stuartjmoore
stuartjmoore / gist:1076642
Created July 11, 2011 19:46
Render Sphere in OpenGL ES for iOS, converted from http://www.codesampler.com/oglsrc/oglsrc_9.htm
void renderSphere(float cx, float cy, float cz, float r, int p)
{
float theta1 = 0.0, theta2 = 0.0, theta3 = 0.0;
float ex = 0.0f, ey = 0.0f, ez = 0.0f;
float px = 0.0f, py = 0.0f, pz = 0.0f;
GLfloat vertices[p*6+6], normals[p*6+6], texCoords[p*4+4];
if( r < 0 )
r = -r;