-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
#version 300 es | ||
|
||
precision mediump float; | ||
precision highp float; | ||
|
||
// the varied color passed from the vertex shader | ||
in vec4 v_color; | ||
|
||
// we need to declare an output for the fragment shader | ||
out vec4 out_color; | ||
|
||
void main() { | ||
out_color = v_color; | ||
} | ||
out_color = v_color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
#version 300 es | ||
// will pass vec3, but will be converted to vec4 with w = 1.0 | ||
|
||
// an attribute is an input (in) to a vertex shader. | ||
// It will receive data from a buffer | ||
in vec4 a_position; | ||
in vec4 a_color; | ||
|
||
// A matrix to transform the positions by | ||
uniform mat4 u_matrix; | ||
|
||
// a varying the color to the fragment shader | ||
out vec4 v_color; | ||
|
||
void main() { | ||
// Multiply the position by the matrix. | ||
vec4 position = u_matrix * a_position; | ||
|
||
// apply "perspective" | ||
gl_Position = vec4(position.xyz, 1.0 + position.z * 2.0); | ||
gl_Position = u_matrix * a_position; | ||
|
||
v_color = a_color; | ||
} | ||
// Pass the color to the fragment shader. | ||
v_color = a_color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters