Comments (2)
Are you referring to games like the snake example? When you have one canvas 2d for drawing and a canvas webgl for post-processing?
If so, it is not fixable in the library itself, glsl.js is a tiny toolkit on top of GLSL, using a canvas2d with it is already a specific use-case.
But you can easily solve that in different ways, here is one:
put the 2 canvas one on top of the other :)
canvas#2d {
position: absolute;
top: 0;
bottom: 0;
z-index: 1;
}
canvas#webgl {
position: absolute;
top: 0;
bottom: 0;
z-index: 2;
}
Then check for support:
// ... do your canvas #2d work
if (Glsl.supported()) {
// Do your Glsl({ .. }) with the canvas #webgl
}
A canvas is transparent by default, so it should make the 2d canvas visible if you don't use it.
from deprecated-glsl.js.
I did indeed base this issue on the snakes example :)
I just figured that the library always took a canvas as input for the shaders but your response makes perfect sense when the input can be from any source(s).
Thanks for your reply and (another) great library :)
from deprecated-glsl.js.
Related Issues (14)
- Using textContent instead of innerHTML
- Texture examples don't work on some machine HOT 5
- More flexibility on the vec2, vec3 and vec4 binding
- Support for <canvas> as an input HOT 1
- Support for <video> as an input HOT 1
- Simplifying the parsing?
- WebGL leak for textures? HOT 1
- Vertex Shaders HOT 1
- Texture Copy Speed HOT 2
- advanced examples are not working on Opera
- Unable to synchronize WebGL-enabled canvas to Sampler2d HOT 2
- refactor and trusting existing libraries
- NPM support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deprecated-glsl.js.