added a program that just copies input to output

This commit is contained in:
DaniTheSkunk 2022-12-12 09:53:42 +00:00
parent 3102e1c909
commit 68acfcad9d
1 changed files with 37 additions and 0 deletions

View File

@ -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;
}
}