Skip to content

Commit eda80a6

Browse files
committed
adds boilerplate shaders
1 parent 8158c03 commit eda80a6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

shaders/shader.frag

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#version 150
2+
3+
uniform vec4 globalColor;
4+
5+
out vec4 outputColor;
6+
7+
void main()
8+
{
9+
outputColor = globalColor;
10+
}

shaders/shader.vert

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#version 150
2+
3+
// these are for the programmable pipeline system
4+
uniform mat4 modelViewProjectionMatrix;
5+
in vec4 position;
6+
7+
// the time value is passed into the shader by the OF app.
8+
uniform float time;
9+
10+
11+
void main()
12+
{
13+
// the sine wave travels along the x-axis (across the screen),
14+
// so we use the x coordinate of each vertex for the calculation,
15+
// but we displace all the vertex along the y axis (up the screen)/
16+
float displacementHeight = 100.0;
17+
float displacementY = sin(time + (position.x / 100.0)) * displacementHeight;
18+
19+
vec4 modifiedPosition = modelViewProjectionMatrix * position;
20+
modifiedPosition.y += displacementY;
21+
gl_Position = modifiedPosition;
22+
}

0 commit comments

Comments
 (0)