Skip to content

Commit

Permalink
Add simple perspective effect
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Jan 20, 2024
1 parent 524a592 commit 860d5e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion example/shader_vertex_3d.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ uniform mat4 u_matrix;
varying vec4 v_color;

void main() {
gl_Position = u_matrix * a_position;
// Multiply the position by the matrix.
vec4 position = u_matrix * a_position;

// apply "perspective"
gl_Position = vec4(position.xyz, 1.0 + position.z * 0.5);

v_color = a_color;
}

0 comments on commit 860d5e7

Please sign in to comment.