mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
Merge pull request #73 from kichikuou/gles
Fix shader compilation errors in OpenGL ES
This commit is contained in:
@@ -27,9 +27,9 @@ void main() {
|
||||
int size = int(floor(threshold));
|
||||
int cutoff = size + 1;
|
||||
float edge_weight = fract(threshold);
|
||||
vec2 tex_size = textureSize(tex, 0).xy;
|
||||
vec2 tex_size = vec2(textureSize(tex, 0).xy);
|
||||
|
||||
float a_out = 0;
|
||||
float a_out = 0.0;
|
||||
|
||||
for (int x = -cutoff; x <= cutoff; x++) {
|
||||
for (int y = -cutoff; y <= cutoff; y++) {
|
||||
@@ -37,7 +37,7 @@ void main() {
|
||||
if (d > threshold)
|
||||
continue;
|
||||
float a = texture(tex, tex_coord + vec2(x, y) / tex_size).r;
|
||||
if (d > size)
|
||||
if (d > float(size))
|
||||
a *= edge_weight;
|
||||
a_out += a;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ out vec4 frag_color;
|
||||
void main() {
|
||||
vec2 p = tex_coord - center;
|
||||
float a = atan(p.y, p.x);
|
||||
a = mod(a - start_angle, 2 * PI);
|
||||
a = mod(a - start_angle, 2.0 * PI);
|
||||
if (a > angle)
|
||||
discard;
|
||||
frag_color = color;
|
||||
|
||||
+2
-1
@@ -36,7 +36,8 @@ struct sdl_private sdl;
|
||||
static const GLchar glsl_preamble[] =
|
||||
#ifdef USE_GLES
|
||||
"#version 300 es\n"
|
||||
"precision highp float;\n";
|
||||
"precision highp float;\n"
|
||||
"precision highp int;\n";
|
||||
#else
|
||||
"#version 140\n";
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user