gam0022 / resimulated

1st place at Revision 2020 (PC 64K Intro)
MIT License
18 stars 1 forks source link

ツール系TODO #1

Open gam0022 opened 4 years ago

gam0022 commented 4 years ago
gam0022 commented 4 years ago
#version 300 es
#ifdef GL_ES
precision highp float;
precision highp int;
precision mediump sampler3D;
#endif
#define HW_PERFORMANCE 1
uniform vec3      iResolution;
uniform float     iTime;
uniform float     iChannelTime[4];
uniform vec4      iMouse;
uniform vec4      iDate;
uniform float     iSampleRate;
uniform vec3      iChannelResolution[4];
uniform int       iFrame;
uniform float     iTimeDelta;
uniform float     iFrameRate;
struct Channel
{
    vec3  resolution;
    float time;
};
uniform Channel iChannel[4];
uniform sampler2D iChannel0;
uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannel3;
void mainImage( out vec4 c,  in vec2 f );
// StrangeCharBug.glsl

/*
There seems to be 'UNKNOWN' characters like '\' or '@', which produces error message
  Unknown Error: ERROR: 0: ? : '' : syntax error
in the 1st source line of my firefox browser(Win7). 

- Who produces that error - the browser, WebGL2 implementation, the graphics card ?
- Why is the error message not appearing in the proper line?
- Where can I get more info about GLSL compiling?

other bugs: 
 matrix      https://www.shadertoy.com/view/XdByzc
 moduli      https://www.shadertoy.com/view/Xlt3W4
 overview    https://www.shadertoy.com/results?query=glsl+bug
*/

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord.xy / iResolution.xy;
    fragColor = vec4(0);
    fragColor.r = sin(88.*uv.x) + sin(55.*uv.y) + 0.5+2.*sin(iTime*2.);

    // uncomment one of the following lines to get the 'unknown' error message
    //\
    //@
}

// 2017-01-22 note:  In the meantime iq made some changes.
// Now you have to uncomment both lines to get the error message.

out vec4 outColor;

void main( void ){vec4 color = vec4(0.0,0.0,0.0,1.0);mainImage( color, gl_FragCoord.xy );color.w = 1.0;outColor = color;}