GithubHelp home page GithubHelp logo

halvves / shader-doodle Goto Github PK

View Code? Open in Web Editor NEW
496.0 15.0 37.0 72.82 MB

A friendly web-component for writing and rendering shaders.

Home Page: https://shader-doodle-overview.glitch.me/

License: MIT License

JavaScript 100.00%
webgl glsl shaders shadertoy shader-playback glsl-sandbox vertex-shaders canvas texture uniform

shader-doodle's People

Contributors

bengfarrell avatar dependabot[bot] avatar halvves avatar nathanvogel avatar safrmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shader-doodle's Issues

[BUG] - window resize blows away buffers

Describe the bug
When the window gets resized, buffers end up as empty textures.

To Reproduce
Steps to reproduce the behavior:

  1. visit http://cdpn.io/e/GRMBaYR
  2. resize the window
  3. see that game of life state end up empty

Expected behavior
I am somewhat unsure since the textures size is changing, but at the very least we shouldn't completely lose previous data.

Desktop (please complete the following information):

  • OS: any/all
  • Browser any/all
  • Version v1.0.0-alpha.20

Smartphone (please complete the following information):

  • Device: any/all
  • OS: any/all
  • Browser any/all
  • Version v1.0.0-alpha.20

[BUG] sd-texture: external image in `src` and `force-update` leads to a WebGL error

Describe the bug
sd-texture with an external image url as a source and force-update attribute produces a WebGL INVALID_VALUE error.

To Reproduce
Steps to reproduce the behavior:

  1. Use an external url for the src attribute of an sd-texture element.
  2. Add a force-update attribute to the element.
  3. Clear the browser's cache and use network throttling to be sure the image loads after the component was instantiated.
  4. When the image is loaded, it doesn't set as a texture, a WebGL: INVALID_VALUE: texImage2D: no canvas error in the console.

Expected behavior
An image is set a as texture when loaded, no WebGL errors in the console.

Screenshots
http://s.csssr.ru/UGLC8598A/20200613114101.png

Additional context
A pen to reproduce the bug: https://codepen.io/peregrimm/pen/RwrRPKO?editors=1000

possible api tweak for v1

While I love the simplicity of the current api, it runs into issues with certain formats of code.

If someone writes something like if (a<c), the usage of either innerHTML or textContent breaks down. There is no way (that I know of) to prevent the <c being parsed as a new node.

I have a few potential solutions...

The traditional <script type="x-shader/x-fragment" />:

<script id="my-shader" type="x-shader/x-fragment">
  ...SHADERCODE
</script>
<shader-doodle src="#my-shader"></shader-doodle>

This solution would create two attributes: raw and src. src could receive a url or an id selector, and raw would take a plain string (primarily for usage in js/react/vue).

A custom script tag <script is="shader-doodle-main" />:

<shader-doodle>
  <script is="shader-doodle-main">
    ...SHADERCODE
  </script>
</shader-doodle>

This would open up shader-doodle for more modular components for adding additional passes/uniforms/etc...
you could add more processing/channels like

<shader-doodle>
  <script is="shader-doodle-main">
    ...SHADERCODE
  </script>
  <script is="shader-doodle-pass" order="0">
    ...MORE
  </script>
  <script is="shader-doodle-pass" order="1">
    ...MORE
  </script>
  <shader-doodle-uniform val="..." type="..." name="..."></shader-doodle-uniform>
  <shader-doodle-texture src="..." type="..." name="..."></shader-doodle-texture>
</shader-doodle>

Or something along that line.

I would love to get opinions/thoughts.

Collaborate?

Hey! I had a similar idea awhile back, but I didn't follow through with anything after making it. I dig that you're tying into Shader Toy. You list next steps as webcam support. That's like the main thing mine supports. I also created a simple tooling task to turn glsl files into ES6 modules.

Anyway I wouldn't mind seeing something come out of my efforts, and you're doing something so similar...

Here's mine: https://github.com/creativecode-webcomponents/ccwc-video

If you want to do it all yourself, I completely understand - but I could see if it's easy to port my code if you're interested (or the other way around, whatever).

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.