Changeset 69dccfe in opengl-game for shaders/shader.frag


Ignore:
Timestamp:
Aug 6, 2019, 7:01:45 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
5f3dba8
Parents:
bba12e7
Message:

Implement a translucent, fullscreen overlay that shows a loaded texture. This will later be used to show a UI rendered by SDL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shaders/shader.frag

    rbba12e7 r69dccfe  
    33
    44layout(binding = 1) uniform sampler2D texSampler;
     5layout(binding = 2) uniform sampler2D uiTexSampler;
    56
    67layout(location = 0) in vec3 fragColor;
    78layout(location = 1) in vec2 fragTexCoord;
     9layout(location = 2) flat in uint isOverlay;
    810
    911layout(location = 0) out vec4 outColor;
    1012
    1113void main() {
    12    outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0);
     14   if (isOverlay == 1) {
     15      outColor = vec4(fragColor * texture(uiTexSampler, fragTexCoord).rgb, 0.3);
     16   } else {
     17      outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0);
     18   }
    1319}
Note: See TracChangeset for help on using the changeset viewer.