diff options
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/quad.frag | 14 | ||||
| -rw-r--r-- | resources/quad.vert | 13 |
2 files changed, 16 insertions, 11 deletions
diff --git a/resources/quad.frag b/resources/quad.frag index 3e85ecf..73869cb 100644 --- a/resources/quad.frag +++ b/resources/quad.frag @@ -1,13 +1,15 @@ #version 330 core -in vec3 fragColor; +in vec2 UV; -out vec4 color; +out vec3 color; -//uniform sampler2D textureSampler; +uniform sampler2D textureSampler; void main() { - color.x = fragColor.x; - color.y = fragColor.y; - color.z = fragColor.z; + vec3 c = texture(textureSampler, UV).rgb; + color = vec3( + c.x / 2 + UV.x / 2, + c.y / 2 + UV.y / 2, + c.z); } diff --git a/resources/quad.vert b/resources/quad.vert index f73ad12..3365748 100644 --- a/resources/quad.vert +++ b/resources/quad.vert @@ -1,18 +1,21 @@ #version 330 core layout(location = 0) in vec2 pos; +layout(location = 1) in vec2 uv; -out vec3 fragColor; +out vec2 UV; uniform mat4 MVP; void main() { gl_Position = - MVP * vec4( pos.x, 1, pos.y, 1); + MVP * + vec4( pos.x, 1, pos.y, 1); + UV = uv; //vec4(pos.x, 1.0, pos.y, 1.0); - fragColor.x = gl_Position.x; - fragColor.y = gl_Position.y; - fragColor.z = gl_Position.z; + //fragColor.x = gl_Position.x; + //fragColor.y = gl_Position.y; + //fragColor.z = gl_Position.z; } |
