I need to draw a sphere that has half of the surface of one color and half of another color. At the moment, I am using glusphere with a texture and is fine. My problem is that I would like to fill the inner latitudal circles like in the attached image . I suppose that by using glusphere I cannot do that. That is why I was thinking in drawing the sphere using vertexes like the code that I attach here. In that code the first for loop increments by lat/4 so you will only see 4 circles (just to test). Circles inside are filled fine but,
[ol]
[li]How can I paint the outer surface between that circles?
[/li][li]Is there any way to agroup all vertexes so I just need to call traslate and rotate once?
[/li][li]Do you think in a better way to do what I want?
[/li][/ol]
My solution needs to run in a PC as an animation. I am using JOGL.
[ATTACH=CONFIG]1429[/ATTACH]
float rgba[] = {1f,0f,0f};
gl.glMaterialfv(GL.GL_FRONT, GL2.GL_AMBIENT, rgba, 0);
gl.glMaterialfv(GL.GL_FRONT, GL2.GL_SPECULAR, rgba, 0);
gl.glMaterialf(GL.GL_FRONT, GL2.GL_SHININESS, 1f);
gl.glEnable(gl.GL_POLYGON_SMOOTH);
gl.glPolygonMode(GL.GL_FRONT_AND_BACK, gl.GL_FILL);
int r=1;
int lats = 64;
int longs = 64;
int i, j;
for(i = 0; i <= lats; i+=lats/4) {
double lat0 = Math.PI * (-0.5 + (double) (i - 1) / lats);
double z0 = Math.sin(lat0);
double zr0 = Math.cos(lat0);
double lat1 = Math.PI * (-0.5 + (double) i / lats);
double z1 = Math.sin(lat1);
double zr1 = Math.cos(lat1);
gl.glBegin(gl.GL_POLYGON);
for(j = 0; j <= longs; j++) {
double lng = 2 * Math.PI * (double) (j - 1) / longs;
double x = Math.cos(lng);
double y = Math.sin(lng);
gl.glNormal3d(x * zr0, y * zr0, z0);
gl.glVertex3d(x * zr0, y * zr0, z0);
gl.glNormal3d(x * zr1, y * zr1, z1);
gl.glVertex3d(x * zr1, y * zr1, z1);
}
gl.glEnd();
}