title: OpenGL Weird Red Green and Blue Lines on Cube Map and Repeating Three Times
body: <p>Please check following image:</p>
  
  <p><a href="https://i.stack.imgur.com/dZiYNm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dZiYNm.jpg" alt="enter image description here"></a>
  <br></p>
  
  <p>I cannot figure out why this is happening, it just doesn’t make sense, I’ve checked it over and over and it keeps showing the same thing, three of the same image on each side of the skybox and red, green and blue stripes going down them.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Vertex Shader:</p>
  
  <pre><code>#version 400
  in vec3 position;
  
  uniform mat4 mvp;
  out vec3 tex;
  void main(void) {
      gl_Position = mvp * vec4(position, 1.0);
      tex = position;
  }
  </code></pre>
  
  <p>Fragmant Shader:</p>
  
  <pre><code>#version 400
  uniform samplerCube defuse;
  in vec3 tex;
  
  out vec4 out_Color;
  void main(void) {
      out_Color = texture(defuse, tex);
  }
  </code></pre>
  
  <p>CubeMap Loader</p>
  
  <pre><code>GLuint texture;
  glGenTextures(1, &amp;texture);
  glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
  
  int width, height, numComponents;
  unsigned char* imageData = stbi_load((path.getURL() + "posx.png").c_str(), &amp;width, &amp;height, &amp;numComponents, 4);
  glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
  stbi_image_free(imageData);
  imageData = stbi_load((path.getURL() + "posy.png").c_str(), &amp;width, &amp;height, &amp;numComponents, 4);
  glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
  stbi_image_free(imageData);
  imageData = stbi_load((path.getURL() + "posz.png").c_str(), &amp;width, &amp;height, &amp;numComponents, 4);
  glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
  stbi_image_free(imageData);
  imageData = stbi_load((path.getURL() + "negx.png").c_str(), &amp;width, &amp;height, &amp;numComponents, 4);
  glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
  stbi_image_free(imageData);
  imageData = stbi_load((path.getURL() + "negy.png").c_str(), &amp;width, &amp;height, &amp;numComponents, 4);
  glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
  stbi_image_free(imageData);
  imageData = stbi_load((path.getURL() + "negz.png").c_str(), &amp;width, &amp;height, &amp;numComponents, 4);
  glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
  stbi_image_free(imageData);
  
  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);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 0);
  glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
  return new GLTexture(texture);
  </code></pre>