Questions tagged [webgl2]
WebGL 2 is the 2nd version of WebGL. It is based on OpenGL ES 3.0
webgl2
426
questions
0
votes
1
answer
49
views
webgl2 trouble rendering float texture to canvas
If I use webgl2 to render something (e.g. a triangle) to an RGBA UNSIGNED_BYTE texture, then render that texture to the canvas, everything works fine. But I'm having trouble getting my example to work ...
0
votes
1
answer
40
views
webgl2 Reading from a RGBA16UI framebuffer with readPixels
I have a webgl2 application in which I'm rendering to a framebuffer and then reading the values with readPixels. This works fine when I initialize the framebuffer and later call readPixels both with ...
0
votes
0
answers
22
views
WebGL.getUniformLocation Offset usage
I'm new to WebGL, i have the code below:
var n = WebGL.createProgram();
WebGL.useProgram(n);
WebGL.uniform1i(WebGL.getUniformLocation(n, "uO"), 2880);
What this command means, Offset ...
0
votes
0
answers
26
views
Why does adding a default branch in a switch statement of a WebGL2 fragment shader trigger dead code elimination for a uniform?
I have the following illustrative fragment shader.
#version 300 es
precision highp float;
flat in int v_Discriminator;
uniform float u_Numbers[2];
out vec4 out_Color;
void main () {
vec4 gray = ...
0
votes
0
answers
49
views
TransformFeedback with instanced drawing
How does WebGL write data to a transform-feedback output when doing instanced drawing? Particularly, how does it decide on what index of the transform-feedback-buffer to write to when using instanced ...
0
votes
0
answers
105
views
Confusion on webgl2 about format and sampler type mismatch
I am tring to implement a GPU accelerated computation with Javascript
I input the image by
const gl = this.renderer.getContext(); //this.renderer is a THREE.WebGLRenderer
this....
0
votes
0
answers
17
views
Single WebGL 2.0 shader for multiple texture precisions
I have a graphics filter (shader) written in GLSL for WebGL 2.0. I would like it to accept a texture having one of three formats:
8-bit Uint
16-bit Uint
32-bit Float
As I understand from here, for ...
0
votes
1
answer
64
views
How can I send large arrays of objects to a fragment shader using WebGL2?
For a university assignment, I've written a raytracer in JavaScript using a Canvas with a 2D context. To make it faster, I'm converting it from a 2D context to a WebGL2 context.
In the original code, ...
1
vote
1
answer
157
views
WebGL 2.0 unsigned integer input variable
I've been trying to point an Uint32Array buffer to a uint input variable.
All the information I can find online says that it should be possible, yet I get the same error no matter what I do:
[.WebGL-...
0
votes
0
answers
30
views
Multiple different textures/materials on 3D heightmap
over the weeks I have created a chunked infinite heightmap terrain. The chunk system is very simple and is not the topic of this question. The topic of this question is how to create a terrain ...
0
votes
0
answers
20
views
webgl2 with premultipliedAlpha:false and unwanted edges
I am trying to craft a very simple webgl demo with premultipliedAlpha:false. However I am having hard times getting rid of the unwanted dark pixels around the drawn triangles edges. I need this webgl ...
0
votes
1
answer
49
views
Default render color vector for fragment shader when using a frame buffer with multiple attachment?
ChatGPT insists that when using a framebuffer and attaching multiple draw buffers, the 0-indexed one will be the one that when you write to in the shader, it will be rendered on the canvas. However I ...
1
vote
1
answer
58
views
Is antialias possible in WebGL 2 if one of your fragment shader outputs is integer?
From my own attempts and reading through the WebGL/OpenGL documentation it seems that it's impossible to anti-alias if you are also writing integer data to your framebuffer object. Is this correct?
...
0
votes
0
answers
32
views
Cannot assign to read only property 'RGBA8' of object '#<WebGLRenderingContext>'
After I upgraded my Chrome browser to version 122.0.6261.70 (Official Build) (64-bit) today, my WebGL program stopped working and threw an exception Cannot assign to read only property 'RGBA8' of ...
1
vote
1
answer
133
views
Can't avoid interpolation of UV : " 'flat' : Illegal use of reserved word "
I want to made that UV are not interpolated, so I can get the exact pixel (As a beginner I see this from that video). Why using 'flat' gives an error?
If I past flat before varying of Uv (I named it ...