mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.55k stars 260 forks source link

500 on save #35

Closed AndrewRayCode closed 2 years ago

AndrewRayCode commented 9 years ago
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at 
[no address given] to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at glslsandbox.com Port 80</address>
</body></html>
AndrewRayCode commented 9 years ago

Shader code:

#ifdef GL_ES
precision mediump float;
#endif

#define PI 3.14159265358979323846
#define cx_arg(z) atan(z.y, z.x)
#define cx_abs(z) length(z)

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;

uniform mat4 viewMatrix;
uniform vec3 cameraPosition;

// Play with this funciton, you drunken clod!!
vec2 f(vec2 z) {
    return vec2(z.x * z.x - z.y * z.y + 2.0 + z.x, z.x * z.y + z.y * z.x + 0e+0 + z.y);
}

// http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
vec3 hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

vec4 domcol(vec2 z) {
    float h = 0.5 + cx_arg(z) / (2.0 * PI);
    float s = abs(sin(2.0 * PI * cx_abs(z)));

    float b  = abs(sin(2.0 * PI * z.y)) * pow(sin(2.0 * PI * z.x), 0.25);
    float b2 = 0.5 * ((1.0 - s) + b + sqrt((1.0 - s - b) * (1.0 - s - b) + 0.01));

    vec3 hsv = vec3(h, sqrt(s), b2);
    return vec4(hsv2rgb(hsv), 1.0);
}

void main() {
    vec2 z = vec2(
        mix(2.0, -2.0, (gl_FragCoord.x + 0.5) / resolution.x),
        mix(2.0, -2.0, (gl_FragCoord.y + 0.5) / resolution.y)
    );

    gl_FragColor = domcol(f(z));
}
emackey commented 9 years ago

@jfontan I've seen some 500 errors on save recently too, but it's intermittent. Is everything OK on Heroku?

jfontan commented 9 years ago

We've moved from heroku to a server hosted in DigitalOcean. There are other problems with old pages that also give error 500.

I've manually loaded old effects and they are in the database. Still don't know what is causing the problems.

jfontan commented 9 years ago

I've fixed the problem with the old pages. I have some errors in the logs that are probably causing the error on save. It seems to be a problem with the post call, probably the image. Still have to test a couple of things to check how it can be fixed.