Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to save specific code #42

Open
makc opened this issue May 11, 2016 · 3 comments
Open

unable to save specific code #42

makc opened this issue May 11, 2016 · 3 comments

Comments

@makc
Copy link

makc commented May 11, 2016

#ifdef GL_ES
precision mediump float;
#endif

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

void main( void ) {

    vec2 position = ( gl_FragCoord.xy / resolution.xy ) - vec2(.5);

    float angle = atan(position.y / position.x) + sign(position.x) * 3.1415 * 0.5;

    // see, this looks almost like atan2
    gl_FragColor = vec4( vec3 (0.5 + angle / 3.1415), 1.0 );

    float rotx = sin(angle * 0.5) * position.x - cos(angle * 0.5) * position.y;

    gl_FragColor = vec4( vec3 (0.5 + 0.5 * cos(rotx * 700.0)), 1.0 );

}

it was saving ok until I changed sin to cos in gl_FragColor = ... line.

won't accept it as new code either.

@AnastasiaDunbar
Copy link

@makc
Copy link
Author

makc commented Jan 7, 2021

Still happens in 2020, of course

#ifdef GL_ES
precision mediump float;
#endif


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

#define TAU 6.28318530718
#define MAX_ITER 5


void main( void ) {


	float t = time * .5+23.0;
    // uv should be the 0-1 uv of texture...
	vec2 xy = gl_FragCoord.xy / resolution.yy -vec2(0.5);

	vec2 uv = vec2(
		atan(xy.y, xy.x) * 7.0 / TAU,
		log(length(xy)) * 0.8
	);

	vec2 p = mod(uv*TAU, TAU)-250.0;
	vec2 i = vec2(p);
	float c = 0.8;
	float inten = .005;

	for (int n = 0; n < MAX_ITER; n++) 
	{
		float t = t * (1.0 - (3.5 / float(n+1)));
		i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));
		c += 1.0/length(vec2(p.x / (sin(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));
	}
	c /= float(MAX_ITER);
	c = 1.17-pow(c, 1.4);
	vec3 colour = vec3(pow(abs(c), 8.0));
    colour = clamp(colour + vec3(
	    0.20 + 0.40 * (1.0 + cos(time * 2.0 + length(uv.y) * 3.0)),
	    0.10 + 0.15 * (1.0 + sin(time * 3.0 + length(uv.y) * 7.0)),
	    0.05 + 0.05 * (1.0 + cos(time * 5.0 + length(uv.y) * 9.0))
    	), 0.0, 1.0);
    

	gl_FragColor = vec4(colour, 1.0);
}

@makc
Copy link
Author

makc commented Jan 7, 2021

the original code from #42 (comment) can be saved now, but not the code from #42 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants