I have strange problem with drawing skybox texture on Mac. On iPhone everything is going fine. I have tried to change near and far planes value with no success.
It is a skybox of six textures, and for every texture I set this:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
What could be the problem?
Screenshot:
EDIT:
I have tried to set background color to red, to ensure if it is bleeding through the texture
I have also tried to change coords of the texture to this:
float err_corr = 0.5 / TEXTURE_SIZE;
GLfloat vertices[24] = {
-1.0f - err_corr, -1.0f - err_corr, 1.0f + err_corr,
1.0f + err_corr, -1.0f - err_corr, 1.0f + err_corr,
-1.0f - err_corr, 1.0f + err_corr, 1.0f + err_corr,
1.0f + err_corr, 1.0f + err_corr, 1.0f + err_corr,
-1.0f - err_corr, -1.0f - err_corr, -1.0f - err_corr,
1.0f + err_corr, -1.0f - err_corr, -1.0f - err_corr,
-1.0f - err_corr, 1.0f + err_corr, -1.0f - err_corr,
1.0f + err_corr, 1.0f + err_corr, -1.0f - err_corr,
};
And the box is drawn in this order:
GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1};
SOLUTION:
The solution is to set GL_CLAMP_TO_EDGE for the cubemap itself!
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);