Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Dooskington
Created October 9, 2018 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dooskington/df7b6177f1e2b504b7995c66348e00de to your computer and use it in GitHub Desktop.
Save Dooskington/df7b6177f1e2b504b7995c66348e00de to your computer and use it in GitHub Desktop.
Shaders
FRAGMENT:
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec4 fragColor;
layout(location = 1) in vec2 fragUv;
layout(location = 0) out vec4 target;
layout(set = 0, binding = 1) uniform texture2D colorMap;
layout(set = 0, binding = 2) uniform sampler colorSampler;
void main() {
target = fragColor * texture(sampler2D(colorMap, colorSampler), fragUv);
}
VERTEX:
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec4 inColor;
layout(location = 2) in vec2 inUv;
layout(location = 0) out vec4 fragColor;
layout(location = 1) out vec2 fragUv;
layout(binding = 0) uniform UniformBufferObject {
mat4 view;
mat4 model;
mat4 projection;
} ubo;
void main() {
fragColor = inColor;
fragUv = inUv;
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPosition, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment