When I generate a gradient using the following code it produces a strange crack like gradient near the center of the image.
The generation code:
void getRgb(GLfloat* pixels1,GLubyte* out)//convert fractional values into color
{
for (int i = 0;i < 90*90;i++)
{
out[(i*3)+0] = pixels1[i]*255;
out[(i*3)+1] = pixels1[i]*255;
out[(i*3)+2] = pixels1[i]*255;
}
}
//gradient generation
multiplier = new GLfloat[90*90];// calc multiplier map
for(int i = 0;i < 90;i++)//2d to 1d
{
for (int j = 0;j < 90;j++)
multiplier[i*90 + j] = cos((j)*(3.14/180));
}
SDL_Surface * image = SDL_CreateRGBSurface(SDL_SWSURFACE, 89, 89, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0);
GLubyte* save = new GLubyte[90*90*3];
getRgb(multiplier,save);
image->pixels = save;
std::string path = "map.bmp";
SDL_SaveBMP(image, path.c_str());
delete save;
image->pixels = NULL;
SDL_FreeSurface(image);
The resulting artifact.