Skip to content
Advertisement

Tag: glsl

How to ‘unbunch’ (co)sine waves in a 2D context?

For reference, here’s a jsfiddle I’m using to test stuff: https://jsfiddle.net/roomyrooms/7L1n02fs/57/ And here’s a gif demonstrating my issue: https://i.gyazo.com/a18e7fe19b76a93655a2cc89f166dd61.mp4 And my fragment code: Basically, I’ve discovered how to reduce the speed of time in WebGl/in trig funcs, as well as decrease their amplitude. What I’m not sure how to do, however, is ‘capture’ a specific part of the wave function

Using mat4 attribute in WebGL2

I am trying to pass a 4×4 matrix as an attribute to WebGL2 vertex shader. After following closely this SO answer, I am stuck with wrapping my head around why I can’t successfully render and get a glDrawArrays: attempt to access out of range vertices in attribute 0 error in my console. It is my understanding that mat4 is represented

WebGL render loop performance

I’ve just started learning WebGL. I am rendering multiple spheres but I’m not sure about the “bindBuffer” and “bufferData” calls inside the render loops. I can render a single sphere with 2 million vertices no problem. But once I try to render 3 spheres with 100k vertices each (300k total, 85% less vertices), the performance starts to go down. I

How do i extend the area of effect on my GLSL shader?

Im new to GLSL, and im writing my very first shader. The shader is written to be used with PIXIjs. I pretty much got the effect i want but it looks like the effect iv created is being masked and limited to the size of my sprite. see picture below.Can anybody tell me what im doing wrong? appreciate it see

webgl trying to draw a triangle

I have been trying to draw a triangle but it is not showing up on the canvas here is my draw function code: here is the whole work: Answer There are some issues: The properties gl.viewportWidth and gl.viewportHeight are never set: In the array of vertex coordinates is a , instead of a . And there is a typo ,

Advertisement