New function recoded:
Code:
//internal
void raydium_sky_sphere_render(GLfloat x, GLfloat y, GLfloat z,int detail)
{
int i, j;
GLfloat currentradious,z1,z2,ang1;
GLfloat p[detail+1][detail+1][3];
//keeping safe the current matrix
glPushMatrix();
angle1+=0.2;
angle2+=0.02;
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
raydium_rendering_internal_prepare_texture_render(raydium_texture_current_main);
raydium_rendering_internal_restore_render_state() ;
glColor4fv(raydium_background_color);
glDepthMask(GL_FALSE);
//MAKING THE SPHERE
//getting the points of the sphere, but no drawing
for(i=0;i<=detail;i++)
{
//getting the radious for each section of the sphere
currentradious = raydium_trigo_sin(180*((float)i/(float)detail));
//getting the heights for each section of the sphere
z1 = raydium_trigo_cos(180*((float)i/(float)detail));
for(j=0;j<=detail;j++)
{
ang1 = 360*((float)j/(float)detail);
p[i][j][0] = currentradious * raydium_trigo_cos(ang1);
p[i][j][1] = currentradious * raydium_trigo_sin(ang1);
p[i][j][2] = z1;
}
}
//now drawing with the obtained values
glTranslatef(x,y,z);
glRotatef(angle2,0,0,1);
glRotatef(angle1,1,0,0);
for(i=0;i<detail;i++)
{
for(j=0;j<detail;j++)
{
//z1=0.5+p[i][j][2]/(float)2;
//z2=0.5+p[i+1][j][2]/(float)2;
z1=1-(float)i/detail;
z2=1-(float)(i+1)/detail;
glBegin(GL_TRIANGLES);
//glColor4f(1,0,0,1);
glColor3f(z1,z1,z1);
glVertex3f(p[i][j][0],p[i][j][1],p[i][j][2]);
//glColor4f(0,1,0,1);
glColor4f(z1,z1,z1,1);
glVertex3f(p[i][j+1][0],p[i][j+1][1],p[i][j+1][2]);
//glColor4f(1,0,1,1);
glColor4f(z2,z2,z2,1);
glVertex3f(p[i+1][j][0],p[i+1][j][1],p[i+1][j][2]);
//glColor4f(1,0,0,1);
glColor4f(z2,z2,z2,1);
glVertex3f(p[i+1][j][0],p[i+1][j][1],p[i+1][j][2]);
//glColor4f(0,1,0,1);
glColor4f(z2,z2,z2,1);
glVertex3f(p[i+1][j+1][0],p[i+1][j+1][1],p[i+1][j+1][2]);
//glColor4f(1,0,1,1);
glColor4f(z1,z1,z1,1);
glVertex3f(p[i][j+1][0],p[i][j+1][1],p[i][j+1][2]);
glEnd();
}
}
//restoring previus states
if(raydium_light_enabled_tag) glEnable(GL_LIGHTING);
if(raydium_fog_enabled_tag) glEnable(GL_FOG);
glDepthMask(GL_TRUE);
glPopMatrix();
}
It works but the color of the sphere is a gradient from black to ¿¿¿blue??? when should be black->white
The error persist in test6.c train.c explo.c and explo2.c(my own test).
![Image](http://img96.imageshack.us/img96/1354/badgradient0jr.th.jpg)