Advertisement
Guest User

Untitled

a guest
Mar 31st, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. _view = glm::translate(_view, {0.f, 0.f, -3.f});
  2. _projection = glm::perspective(glm::radians(FOV), (float)size.x / (float)size.y, 0.1f, 100.f);
  3.  
  4. glUniformMatrix4fv(
  5.     glGetUniformLocation(states.shader->ID, "model"),
  6.     1, GL_FALSE, glm::value_ptr(states.transform.getMatrix())
  7. );
  8.  
  9. glUniformMatrix4fv(
  10.     glGetUniformLocation(states.shader->ID, "view"),
  11.     1, GL_FALSE, glm::value_ptr(_view)
  12. );
  13.  
  14. glUniformMatrix4fv(
  15.     glGetUniformLocation(states.shader->ID, "projection"),
  16.     1, GL_FALSE, glm::value_ptr(_projection)
  17. );
  18.  
  19.  
  20. SHADER---
  21.  
  22. #version 330 core
  23. layout (location = 0) in vec3 aPos;
  24. layout (location = 1) in vec3 aColor;
  25. layout (location = 2) in vec2 aTexCoord;
  26.  
  27. out vec3 ourColor;
  28. out vec2 texCoord;
  29.  
  30. uniform mat4 model;
  31. uniform mat4 view;
  32. uniform mat4 projection;
  33.  
  34. void main()
  35. {
  36.     gl_Position = projection * view * model * vec4(aPos, 1.0);
  37.     texCoord = aTexCoord;
  38.     ourColor = aColor;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement