stackgl / gl-shader Goto Github PK
View Code? Open in Web Editor NEW๐ WebGL shader wrapper
Home Page: http://stackgl.github.io/gl-shader/
License: MIT License
๐ WebGL shader wrapper
Home Page: http://stackgl.github.io/gl-shader/
License: MIT License
when using gl-shader just to check if a GLSL is valid, I expect the library not to side-effect any logs.
I saw that gl-shader
sets an increasing number for the location of each attribute done after the attributes have been sorted lexicographically, the source mentions that there's an undefined WebGL behavior regarding the location of an attribute, if a custom attribute location behavior is defined on gl-shader
may I ask what is the problem with gl.getAttribLocation
?
In order to support WebGL 2.0 a couple things will need to change; namely runtime reflection and getter/setter generators.
I've been working on modularizing some of gl-shader
for my own experiments with WebGL2. You can see some of the work here:
Hi @mikolalysenko ,
first of all, thanks a lot for making this library, it is very smooth!
I'm working on glsl-transition
and I've chosen to depend on your awesome webgl wrapper.
There is one thing I need which is not exposed by your library: getting the original types of uniforms (basically those which are given by glsl-exports
).
My use-case is the following: I want to dynamically allocate textures for sampler2D
uniforms.
Any idea how we could do that? Should we introduce a new field property on a Shaders like shader.types = { uniforms: uniforms, attributes: attributes }
?
Best regards,
@gre
PS: I'm also the creator of the (now old) 'glsl.js' library, and I can say that your library is 10x smoother than mine (I was doing regexp to parse the glsl, can you believe that!), I'm also probably going to refactor it basing it on yours (just keeping the same API).
gl-vis/gl-cone3d#5
that init case does not work in Linux Chrome
I am using gl-react and gl-react-native in my react-native app
It is working fine on IOS but return error on android
error like this
"gl-shader: Error compiling shader: compile failed."
"Compilation errors. No Code generated."
I am really much of time spend for this to working
Any help will be appreciated
Thanks!
Hi,
The argument check isn't executed on the following line:
https://github.com/stackgl/gl-shader/blob/master/lib/create-attributes.js#L133
I would fix it, but I don't know where the result
variable comes from a few lines below:
https://github.com/stackgl/gl-shader/blob/master/lib/create-attributes.js#L139
Best regards,
Agost
The current version use the Function
constructor which make the code incompatible with a secure CSP.
https://github.com/stackgl/gl-shader/blob/master/lib/create-uniforms.js#L9 :
For example:
//Binds a function and returns a value
function identity(x) {
var c = new Function('y', 'return function(){return y}')
return c(x)
}
Could probably be replaced by something like:
//Binds a function and returns a value
function identity(x) {
return function (){return x}
}
The two only other functions using Function
are makeGetter
and makeSetter
.
Related: plotly/plotly.js#897
(sorry @mikolalysenko I feel like I spam you but it's just a coincidence if it's again one of your repository! And I think it's important to document which code can or cannot be used in a secure manner in a browser)
I'm having trouble parsing some of what's in the readme, mainly with how this module was much tighter coupled to the older version of glslify.
var shader = createShader(vertexSource, fragmentSource[, uniforms, attributes])
...
The format of uniforms and attributes is consistent with glslify's output
I'm not sure what this format looks like and what exactly these are supposed to do when you feed them in.
var shader = createShader(gl, glslifyResult)
Also this says to take the glslify result, which is no longer relevant. Or if that formatting is relevant, it's not clear how to use it with how glslify has changed.
Getting weird results on the first frame of rendering using a typical setup with gl-geometry
+ gl-shader
and some attributes for position
, normal
. The first frame gl-geometry
sets up the attribute locations accordingly, but it isn't until the second frame that they seem to "kick in." This is a problem for GL apps that only need to be run once (e.g. render scene to texture).
Will keep poking around.
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.