Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #shader vertex
- #version 330 core
- layout(location = 0) in vec2 InPosition;
- layout(location = 1) in vec4 InColor;
- layout(location = 2) in vec2 InTexCoords;
- out vec4 VPos;
- out vec4 VCol;
- out vec2 VTex;
- void main()
- {
- VPos = vec4(InPosition, 0, 1);
- VCol = InColor;
- VTex = InTexCoords;
- }
- #shader geometry
- #version 330 core
- layout(triangles) in;
- layout(triangle_strip, max_vertices = 3) out;
- in vec4 VPos[3];
- in vec4 VCol[3];
- in vec2 VTex[3];
- out vec4 Color;
- out vec2 TexPos;
- void main()
- {
- Color = VCol[0];
- TexPos = VTex[0];
- gl_Position = VPos[0];
- EmitVertex();
- Color = VCol[1];
- TexPos = VTex[1];
- gl_Position = VPos[1];
- EmitVertex();
- Color = VCol[2];
- TexPos = VTex[2];
- gl_Position = VPos[2];
- EmitVertex();
- EndPrimitive();
- }
- #shader fragment
- #version 330 core
- uniform sampler2D Texture;
- in vec4 Color;
- in vec2 TexPos;
- out vec4 ResultColor;
- void main()
- {
- ResultColor = texture(Texture, TexPos) * Color;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement