From ce334547f0f0560386ca8b97f354d83da68019a5 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 16 Dec 2018 22:09:17 +0100 Subject: Generate fluid display using geometry shaders This should provide much more flexibility. For our purpose it would be useful if the vertex shader was executed after the geometry shader (to apply the projection matrix) but alas this is not the case. Thus the MVP matrix is applied during geometry construction and the vertex shader only provides density extraction. --- src/shader/code/vertex.glsl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/shader/code/vertex.glsl') diff --git a/src/shader/code/vertex.glsl b/src/shader/code/vertex.glsl index 0eccad4..0727708 100644 --- a/src/shader/code/vertex.glsl +++ b/src/shader/code/vertex.glsl @@ -1,8 +1,14 @@ static const std::string VERTEX_SHADER_CODE = R"( -uniform mat4 MVP; +#version 430 + +layout (location=0) in vec3 VertexPosition; + +out VS_OUT { + vec3 color; +} vs_out; void main() { - gl_Position = MVP * vec4(gl_Vertex.xy, 0.0, 1.0); - gl_FrontColor = gl_Vertex.z * vec4(1., 0., 0., 0.); + gl_Position = vec4(VertexPosition.xy, 0., 1.); + vs_out.color = vec3(VertexPosition.z, 0., 0.); } )"; -- cgit v1.2.3