Giter Club home page Giter Club logo

Comments (12)

brucelane avatar brucelane commented on May 13, 2024

I think you have to add:

#ifdef GL_ES
precision mediump float;
#endif 

from glslviewer.

brucelane avatar brucelane commented on May 13, 2024

iTime has to be renamed:

uniform float u_time;

from glslviewer.

hyperknot avatar hyperknot commented on May 13, 2024

OK, I did the following manually:

  • Added float: medium
  • replaced all iTime to u_time
  • added u_time global
  • replaced all iResolution to u_resolution
  • added u_resolution global

No errors now, but all I see is 100% whiteness.

http://thebookofshaders.com/edit.php?log=171214193921

from glslviewer.

brucelane avatar brucelane commented on May 13, 2024

replace with

void main(  )
{
    vec3 finalColor; 
    vec2 uv = gl_FragCoord.xy;
    //center of the image
    vec2 c = u_resolution.xy/2.0;
    finalColor = vec3( 0.3*_cross(uv, c, 240.0) );
    finalColor += ( circle(uv, c, 100.0, 1.0)
                  + circle(uv, c, 165.0, 1.0) ) * blue1;
    finalColor += (circle(uv, c, 240.0, 2.0) );//+ dots(uv,c,240.0)) * blue4;
    finalColor += circle3(uv, c, 313.0, 4.0) * blue1;
    finalColor += triangles(uv, c, 315.0 + 30.0*sin(u_time)) * blue2;
    finalColor += movingLine(uv, c, 240.0) * blue3;
    finalColor += circle(uv, c, 10.0, 1.0) * blue3;
    finalColor += 0.7 * circle2(uv, c, 262.0, 1.0, 0.5+0.2*cos(u_time)) * blue3;
    if( length(uv-c) < 240.0 )
    {
        //animate some bips with random movements
        vec2 p = 130.0*MOV(1.3,1.0,1.0,1.4,3.0+0.1*u_time);
        finalColor += bip1(uv, c+p) * vec3(1,1,1);
        p = 130.0*MOV(0.9,-1.1,1.7,0.8,-2.0+sin(0.1*u_time)+0.15*u_time);
        finalColor += bip1(uv, c+p) * vec3(1,1,1);
        p = 50.0*MOV(1.54,1.7,1.37,1.8,sin(0.1*u_time+7.0)+0.2*u_time);
        finalColor += bip2(uv,c+p) * red;
    }

    gl_FragColor = vec4( finalColor, 1.0 );
}

from glslviewer.

hyperknot avatar hyperknot commented on May 13, 2024

Cool, it works, thanks!

So it was in addition:

  • fragCoord -> gl_FragCoord
  • fragColor -> gl_FragColor
  • void mainImage( out vec4 fragColor, in vec2 fragCoord ) -> void main()

?

from glslviewer.

brucelane avatar brucelane commented on May 13, 2024

exactly!

from glslviewer.

hyperknot avatar hyperknot commented on May 13, 2024

Cool, I might submit a PR to glslLoader so it could convert files from disk at least.

Any idea why does editor display only a cropped view, while glslViewer displays more of the extents?

glslviewer fps 60 2017-12-14 21-22-39

from glslviewer.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 13, 2024

Are you in a retina laptop? If that's the case glslViewer will make use of that

from glslviewer.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 13, 2024

ShaderToy have a custom scheme they use to wrap shaders and allow things like doing WebVR. Is not fragCoord, fragColor and mainImage() are not part of GLSL language.

from glslviewer.

hyperknot avatar hyperknot commented on May 13, 2024

Yes, I have retina. But isn't the view always 0,0->1,1? How can one view display totally different parts then the other (in the same aspect ratio)?

from glslviewer.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 13, 2024

Related #101

from glslviewer.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 13, 2024

I believe is not about the aspect ration but about the pixel density. Because the scene is constructed from the center (.5,.5) with the double of the pixels things looks scaled at the half of the size.

Obviously this is not ideal. Needs to be fixed.

thanks for the patience

from glslviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.