Skip to main content
SOLUTION!
Source Link
martin pilch
  • 551
  • 2
  • 6
  • 17

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:

Image of sky with the edges of the skybox visible

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); 

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:

Image of sky with the edges of the skybox visible

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};

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:

Image of sky with the edges of the skybox visible

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); 
Added alt text to the image, miniscule other post formats, and threw in the [sky] tag which seems to be consistently used for skyboxes
Source Link

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 athe problem?

Screenshot: screen

Image of sky with the edges of the skybox visible

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};

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 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 a problem?

Screenshot: screen

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};

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:

Image of sky with the edges of the skybox visible

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};

added description of what I have tried to solve the problem
Source Link
martin pilch
  • 551
  • 2
  • 6
  • 17

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 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 a problem?

Screenshot: screen

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};

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 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 a problem?

Screenshot: screen

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 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 a problem?

Screenshot: screen

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};

deleted 4 characters in body; edited title
Source Link
Tetrad
  • 30.1k
  • 12
  • 96
  • 143
Loading
Tweeted twitter.com/#!/StackGameDev/status/65840973082660865
Source Link
martin pilch
  • 551
  • 2
  • 6
  • 17
Loading