Hello, I am trying to have the best quality for a little planet animation. I have a sphere with a texture on it and I would like to make it better.
I am using 256x256 texture size and when I zoom the sphere it have a lot of little square so I am trying to change the texture size in 512x512 but i get a stack overflow error. I am using BCB6. here is my code :
GLubyte bits[256][256][4];
bitmap->LoadFromFile("sfondo.bmp"); // blue.bmp
for(int i = 0; i < 256; i++)
{
for(int j = 0; j < 256; j++)
{
bits[i][j][0]= (GLbyte)GetRValue(bitmap->Canvas->Pixels[i][j]);
bits[i][j][1]= (GLbyte)GetGValue(bitmap->Canvas->Pixels[i][j]);
bits[i][j][2]= (GLbyte)GetBValue(bitmap->Canvas->Pixels[i][j]);
bits[i][j][3]= (GLbyte)255;
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glGenTextures(1, &texture3);
glBindTexture(GL_TEXTURE_2D, texture3);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, bits);
If i change all “256” value into “512” i get that error.
How can i fix it ?
Any idea on how to improve the quality ?
Thank you very much
Alfredolo