source: opengl-game/color.vert@ 4f3262f

feature/imgui-sdl points-test
Last change on this file since 4f3262f was 14ff67c, checked in by Dmitry Portnoy <dmp1488@…>, 6 years ago

Use uniform buffers to store model matrices and add constants to toggle FPS display and vsync.

  • Property mode set to 100644
File size: 779 bytes
RevLine 
[ec4456b]1#version 410
2
[14ff67c]3#define MAX_NUM_OBJECTS 1024
[93baa0e]4
[14ff67c]5uniform mat4 view, proj;
6
7layout (std140) uniform models {
8 mat4 model_mats[MAX_NUM_OBJECTS];
[e165b85]9};
10
[d0b9596]11layout(location = 0) in vec3 vertex_position;
12layout(location = 1) in vec3 vertex_color;
[9dd2eb7]13layout(location = 2) in vec3 vertex_normal;
[14ff67c]14layout(location = 3) in uint ubo_index;
[8b7cfcf]15
[9dd2eb7]16out vec3 position_eye, normal_eye, color, light_position_eye;
17
18// fixed point light position
19vec3 light_position_world = vec3(0.0, 0.0, 2.0);
[ec4456b]20
21void main() {
[14ff67c]22 position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0));
23 normal_eye = vec3(view * model_mats[ubo_index] * vec4 (vertex_normal, 0.0));
[8b7cfcf]24 color = vertex_color;
[9dd2eb7]25 light_position_eye = vec3(view * vec4(light_position_world, 1.0));
26
27 gl_Position = proj * vec4(position_eye, 1.0);
[ec4456b]28}
Note: See TracBrowser for help on using the repository browser.