Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 330 core
- in vec3 vs_in_pos;
- uniform mat4 view;
- uniform mat4 projection;
- out vec3 WorldPos;
- void main()
- {
- WorldPos = vs_in_pos;
- mat4 rotView = mat4(mat3(view));
- vec4 clipPos = projection * rotView * vec4(WorldPos, 1.0);
- gl_Position = -clipPos.xyww; // without the minus sign, it is not visible
- }
- #version 330 core
- in vec3 WorldPos;
- out vec4 FragColor;
- uniform samplerCube cubeTexture;
- void main()
- {
- FragColor = vec4(texture(cubeTexture, WorldPos).rgb, 1.0);
- }
- glDisable(GL_DEPTH_TEST);
- glDepthMask(GL_FALSE);
- skybox_program.Enable();
- skybox_program.SetCubeTexture("cubeTexture", 0, env_map);
- skybox_program.SetUniform("view", camera.GetView());
- skybox_program.SetUniform("projection", camera.GetProj());
- RenderCube();
- glDepthMask(GL_TRUE);
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement