Add ortographic camera
This commit is contained in:
parent
4a3dfeafdc
commit
8c4b7bff18
5 changed files with 202 additions and 14 deletions
|
|
@ -1,14 +1,20 @@
|
|||
#version 330 core
|
||||
layout (location = 0) in vec3 pos;
|
||||
uniform vec4 uniform_color;
|
||||
uniform mat4 camera;
|
||||
uniform vec2 window_size;
|
||||
out vec4 vertex_color;
|
||||
const mat4 to_draw_coordinates_matrix = mat4(
|
||||
1., 0., 0., 0.,
|
||||
0., -1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
-1, 1, 0, 1);
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = to_draw_coordinates_matrix*vec4(pos, 1.0f);
|
||||
float aspect_ratio = window_size.x / window_size.y;
|
||||
mat4 scaling_matrix = mat4(1.0);
|
||||
scaling_matrix[1][1] = aspect_ratio;
|
||||
gl_Position = camera*scaling_matrix*to_draw_coordinates_matrix*vec4(pos, 1.0f);
|
||||
vertex_color = uniform_color;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue