Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #version 330 core
  2. in vec3 vs_in_pos;
  3.  
  4. uniform mat4 view;
  5. uniform mat4 projection;
  6.  
  7. out vec3 WorldPos;
  8.  
  9. void main()
  10. {
  11. WorldPos = vs_in_pos;
  12.  
  13. mat4 rotView = mat4(mat3(view));
  14. vec4 clipPos = projection * rotView * vec4(WorldPos, 1.0);
  15.  
  16. gl_Position = -clipPos.xyww; // without the minus sign, it is not visible
  17.  
  18. }
  19.  
  20. #version 330 core
  21.  
  22. in vec3 WorldPos;
  23.  
  24. out vec4 FragColor;
  25.  
  26. uniform samplerCube cubeTexture;
  27.  
  28. void main()
  29. {
  30. FragColor = vec4(texture(cubeTexture, WorldPos).rgb, 1.0);
  31. }
  32.  
  33. glDisable(GL_DEPTH_TEST);
  34. glDepthMask(GL_FALSE);
  35.  
  36. skybox_program.Enable();
  37.  
  38. skybox_program.SetCubeTexture("cubeTexture", 0, env_map);
  39. skybox_program.SetUniform("view", camera.GetView());
  40. skybox_program.SetUniform("projection", camera.GetProj());
  41.  
  42. RenderCube();
  43.  
  44. glDepthMask(GL_TRUE);
  45. glEnable(GL_DEPTH_TEST);
  46. glDepthFunc(GL_LESS);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement