Changeset 80edd70 in opengl-game for shaders


Ignore:
Timestamp:
Jul 23, 2019, 4:02:06 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
d9ef6ab
Parents:
8667f76
Message:

Use a vertex buffer to store the points to be rendered

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shaders/shader.vert

    r8667f76 r80edd70  
    11#version 450
     2
     3layout(location = 0) in vec2 inPosition;
     4layout(location = 1) in vec3 inColor;
    25
    36layout(location = 0) out vec3 fragColor;
    47
    5 vec2 positions[3] = vec2[](
    6    vec2(0.0, -0.5),
    7    vec2(0.5, 0.5),
    8    vec2(-0.5, 0.5)
    9 );
    10 
    11 vec3 colors[3] = vec3[](
    12    vec3(1.0, 0.0, 0.0),
    13    vec3(0.0, 1.0, 0.0),
    14    vec3(0.0, 0.0, 1.0)
    15 );
    16 
    178void main() {
    18    gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
    19    fragColor = colors[gl_VertexIndex];
     9   gl_Position = vec4(inPosition, 0.0, 1.0);
     10   fragColor = inColor;
    2011}
Note: See TracChangeset for help on using the changeset viewer.