Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Vertex Shader
- #version 450
- layout(binding = 0) uniform UniformBufferObject {
- mat4 model;
- mat4 view;
- mat4 proj;
- } matrices;
- layout(location = 0) in vec3 inPosition;
- layout(location = 1) in uint inID;
- layout(location = 0) out uint ID;
- void main() {
- gl_Position = matrices.proj * matrices.view * matrices.model * vec4(inPosition, 1.0);
- ID = inID;
- }
- -------------------------------------------------------------------------------------------------------------------------------------
- //Fragment Shader
- #version 450
- layout(location = 0) flat in uint ID;
- layout(binding = 1) buffer ShaderStorageBufferObject{
- uint Selected_ID;
- }ssbo;
- layout(location = 0) out float outColor;
- void main() {
- ssbo.Selected_ID = ID;
- //only needed for debugging to draw to color attachment
- outColor = ssbo.Selected_ID;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement