diff --git a/assets/textures/skybox/null_plainsky512_dn.jpg b/assets/textures/skybox/null_plainsky512_dn.jpg index 75f16c1..d15b2f2 100644 Binary files a/assets/textures/skybox/null_plainsky512_dn.jpg and b/assets/textures/skybox/null_plainsky512_dn.jpg differ diff --git a/assets/textures/skybox/null_plainsky512_up.jpg b/assets/textures/skybox/null_plainsky512_up.jpg index 49940da..18e5dd3 100644 Binary files a/assets/textures/skybox/null_plainsky512_up.jpg and b/assets/textures/skybox/null_plainsky512_up.jpg differ diff --git a/src/rendering/renderer.cpp b/src/rendering/renderer.cpp index d5821e1..79a0ba4 100644 --- a/src/rendering/renderer.cpp +++ b/src/rendering/renderer.cpp @@ -33,8 +33,8 @@ void renderInit(GLFWwindow* window) { glEnable(GL_DEPTH_TEST); skyboxTexture = new Skybox({ - "assets/textures/skybox/null_plainsky512_rt.jpg", "assets/textures/skybox/null_plainsky512_lf.jpg", + "assets/textures/skybox/null_plainsky512_rt.jpg", "assets/textures/skybox/null_plainsky512_up.jpg", "assets/textures/skybox/null_plainsky512_dn.jpg", "assets/textures/skybox/null_plainsky512_ft.jpg", @@ -47,6 +47,7 @@ void renderInit(GLFWwindow* window) { } void renderParts() { + glDepthMask(GL_TRUE); // Use shader shader->use(); @@ -101,12 +102,14 @@ void renderParts() { } void renderSkyBox() { + glDepthMask(GL_FALSE); + skyboxShader->use(); glm::mat4 projection = glm::perspective(glm::radians(45.f), (float)1200 / (float)900, 0.1f, 100.0f); // Remove translation component of view, making us always at (0, 0, 0) glm::mat4 view = glm::mat4(glm::mat3(camera.getLookAt())); - + skyboxShader->set("projection", projection); skyboxShader->set("view", view); @@ -121,5 +124,5 @@ void render(GLFWwindow* window) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderSkyBox(); - // renderParts(); + renderParts(); } \ No newline at end of file diff --git a/src/rendering/skybox.cpp b/src/rendering/skybox.cpp index b53b36d..fe6295a 100644 --- a/src/rendering/skybox.cpp +++ b/src/rendering/skybox.cpp @@ -8,15 +8,6 @@ Skybox::Skybox(std::array faces, unsigned int format) { glGenTextures(1, &this->ID); glBindTexture(GL_TEXTURE_CUBE_MAP, this->ID); - // Wrapping - 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); - - // Interpolation - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - // stbi_set_flip_vertically_on_load(true); for (unsigned int i = 0; i< faces.size(); i++) { int width, height, nrChannels; @@ -30,11 +21,17 @@ Skybox::Skybox(std::array faces, unsigned int format) { glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data); - glGenerateMipmap(GL_TEXTURE_2D); - - stbi_image_free(data); } + + // Wrapping + 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); + + // Interpolation + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } Skybox::~Skybox() {