diff --git a/com/danitheskunk/skunkworks/backends/gl/ProgramCopy.java b/com/danitheskunk/skunkworks/backends/gl/ProgramCopy.java new file mode 100644 index 0000000..c1ccb1f --- /dev/null +++ b/com/danitheskunk/skunkworks/backends/gl/ProgramCopy.java @@ -0,0 +1,37 @@ +package com.danitheskunk.skunkworks.backends.gl; + +public class ProgramCopy extends Program { + private static final String fragmentSource = """ + #version 450 + layout(location = 1) in vec2 texCoord; + layout(binding = 0) uniform sampler2D tex; + out vec4 color; + void main() { + vec4 col = texture(tex, texCoord); + if(col.a > 0.0) { + color = col; + } + } + """; + private static final String vertexSource = """ + #version 450 + layout(location = 0) in vec2 pos; + layout(location = 1) out vec2 out_texCoord; + void main() { + gl_Position = vec4(pos, 0.0f, 1.0f); + out_texCoord = vec2(pos.x * 0.5 + 0.5, pos.y * 0.5 + 0.5); + } + """; + private ProgramCopy() { + super(vertexSource, fragmentSource); + } + + private static ProgramCopy instance; + + public static ProgramCopy getInstance() { + if(instance == null) { + instance = new ProgramCopy(); + } + return instance; + } +}