diff --git a/grafika_projekt/shaders/terrainShader.frag b/grafika_projekt/shaders/terrainShader.frag index ae42e3f..4a15458 100644 --- a/grafika_projekt/shaders/terrainShader.frag +++ b/grafika_projekt/shaders/terrainShader.frag @@ -5,7 +5,7 @@ in vec3 surfaceNormal; in vec3 toLightVector; in vec3 toCameraVector; -//out vec4 out_Color; +out vec4 out_Color; uniform sampler2D modelTexture; @@ -31,6 +31,6 @@ void main(void){ vec3 finalSpecular = dampedFactor * reflectivity * vec3(1.0, 1.0, 1.0); //Tu była zmiana - gl_FragColor = vec4(1.0,1.0,1.0,1.0); + out_Color = vec4(diffuse,1.0) * texture(modelTexture,pass_textureCoordinates) + vec4(finalSpecular,1.0); } \ No newline at end of file diff --git a/grafika_projekt/src/main.cpp b/grafika_projekt/src/main.cpp index 658e567..f6f41ba 100644 --- a/grafika_projekt/src/main.cpp +++ b/grafika_projekt/src/main.cpp @@ -371,9 +371,10 @@ void renderScene() glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); glUseProgram(terrainProgram); - glm::mat4 terrainTransformation = glm::translate(glm::vec3(terrain.getX(), 0, terrain.getZ())) * glm::rotate(glm::radians(0.f), glm::vec3(5, 5, 5)); + glm::mat4 terrainTransformation = glm::translate(glm::vec3(0, 0, 0)) * glm::rotate(glm::radians(180.f), glm::vec3(5, 5, 5)); TerrainRenderer terrainRenderer(terrainProgram, perspectiveMatrix, terrain, terrainTransformation, cameraMatrix, lightDir, 0.5f, 0.5f); terrainRenderer.render(); glUseProgram(0);