more shader shenanigans

This commit is contained in:
minjaesong
2023-02-28 17:32:52 +09:00
parent 315b984d3b
commit 2c86c6a461
31 changed files with 97 additions and 92 deletions

View File

@@ -36,36 +36,41 @@ class UIHandler(//var UI: UICanvas,
companion object {
private val SHADER_PROG_FRAG = """
#version 130
#version 150
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
in vec4 v_color;
in vec2 v_texCoords;
uniform sampler2D u_texture;
uniform float opacity;
out vec4 fragColor;
void main(void) {
vec4 color = texture2D(u_texture, v_texCoords).rgba;
vec4 color = texture(u_texture, v_texCoords).rgba;
gl_FragColor = v_color * vec4(color.rgb, color.a * opacity);
fragColor = v_color * vec4(color.rgb, color.a * opacity);
}
""".trimIndent()
private val SHADER_PROG_VERT = """
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
#version 150
in vec4 a_position;
in vec4 a_color;
in vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
out vec4 v_color;
out vec2 v_texCoords;
void main() {
v_color = a_color;
v_color.a = v_color.a * (255.0/254.0);
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}