halvves / shader-doodle Goto Github PK
View Code? Open in Web Editor NEWA friendly web-component for writing and rendering shaders.
Home Page: https://shader-doodle-overview.glitch.me/
License: MIT License
A friendly web-component for writing and rendering shaders.
Home Page: https://shader-doodle-overview.glitch.me/
License: MIT License
Describe the bug
When the window gets resized, buffers end up as empty textures.
To Reproduce
Steps to reproduce the behavior:
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):
Smartphone (please complete the following information):
Is it possible to use YouTube iframe embed video, or HTML5 <video>
tag as texture? I tried with no success until now, maybe I'm missing something... Thanks!
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:
src
attribute of an sd-texture
element.force-update
attribute to the element.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
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.
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).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.