Questions tagged [webgl2]

WebGL 2 is the 2nd version of WebGL. It is based on OpenGL ES 3.0

WebGL 2 is based on OpenGL ES 3.0. See the spec

Getting started with WebGL2:

Webgl2fundamentals.org will get you setup with a basic understanding of WebGL2 and how it works.

Some differences from WebGL 1.0:

  • full support of non power of 2 textures
  • sampler objects
  • query objects
  • uniform buffer objects
  • instancing
  • many new texture formats
  • transform feedback (writing the output of vertex shaders to buffers)
  • GLSL 3.00
  • anti-aliased renderbuffers
405 questions
4
votes
2 answers

Webgl 2.0 unsupported in chrome

My chrome shows Webgl 2.0 - supported, but disabled in browser settings, or blocked by extensions. I have tried 1. Use hardware acceleration in chrome://settings 2. Enabled WEBGL 2.0 in chrome://flags 3. Override software render list .. What other…
Arulraj
  • 61
  • 1
  • 2
  • 4
4
votes
0 answers

Can I construct a bounding volume hierarchy efficiently using WebGL 2 shaders?

Is it feasible to adapt the approach in this paper from CUDA to WebGL 2 shaders and still be efficient? (1) Assign a Morton code for each primitive according to its centroid. Should be easy, as bitwise operations (AND, OR, etc) are available in…
emh
  • 199
  • 10
4
votes
3 answers

WebGL 2.0 Occlusion Query

I want to render a big scene(a modeled city) using WebGL, and I think occlusion culling is a good way to optimize the performance. And I know WebGL 2.0 has a new feature called 'Query Objects' to get the occlusion information. But every time I use…
HT XU
  • 137
  • 1
  • 3
  • 8
3
votes
1 answer

WebGL does not like Index 255 with indexed drawing

Here is a minimal WebGL test program that creates an index buffer with a single uint8 value of 255. It should draw a red square of a size of 64px, it does not (the index value is not really important for the draw). Somehow WebGL ignores Elements…
Danny Raufeisen
  • 953
  • 8
  • 21
3
votes
1 answer

Are there any major differences between webgl and webgl2 APIs?

I'm currently learning WebGL and I found out that there are actually 2 variants of this api -> webgl and webgl2. So I would say that webgl2 is a newer version of the api, therefore it would be better to start with it. But I'm a bit confused now…
anathrax
  • 91
  • 1
  • 1
  • 11
3
votes
1 answer

Decompose a GLSL mat4 to original RTS values within vertex shader to calculate a View UV Offset

I need to get the rotation differences between the model and the camera, convert the values to radians/degrees, and pass it to the fragment shader. For that I need to decompose and the Model rotation matrix and maybe the camera view matrix as well.…
Sadern Alwis
  • 104
  • 1
  • 4
  • 17
3
votes
1 answer

getUniformLocation return null

I have a uniform in my fragment shader and when I try to get the value of the location of the uniform, it returns null. I checked the spelling and I don't find any spelling error and this uniform is also used in the shader code. My error is: error…
Pravin Poudel
  • 1,433
  • 3
  • 16
  • 38
3
votes
1 answer

Using mat4 attribute in WebGL2

I am trying to pass a 4x4 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…
Georgi B. Nikolov
  • 976
  • 2
  • 13
  • 24
3
votes
1 answer

Is it safe to assume that unset sampler2D uniforms will read texture unit 0?

I have multiple textures, one of which gets bound to TEXTURE0 before drawing. In my fragment shaders, I have a single sampler2D uniform such as: uniform sampler2D diffuse; I used to call uniform1f([uniform location], 0) every frame, every shader to…
Finn Bear
  • 33
  • 1
  • 10
3
votes
1 answer

Debugging in WebGL

I am learning WebGL and I can feel that my speed is so slow because I am having a hard time debugging my code. Is there any extension or tool with help of which I can know the value of buffer, attribpointer, matrixes, etc. I googled and learned…
Pravin Poudel
  • 1,433
  • 3
  • 16
  • 38
3
votes
2 answers

What is the correct sequence for uploading a uniform block?

In the example page at https://www.lighthouse3d.com/tutorials/glsl-tutorial/uniform-blocks/ has this: uniformBlockBinding() bindBuffer() bufferData() bindBufferBase() But conceptually, wouldn't this be more…
davidkomer
  • 3,020
  • 2
  • 23
  • 58
3
votes
1 answer

WebGL2 -- How to store and retrieve 3D texture data needed by 3D grid of vertices to calculate new vertex positions

3D Physics simulation needs access to neighbor vertices' positions and attributes in shader to calculate a vertex's new position. 2D version works but am having trouble porting solution to 3D. Flip-Flopping two 3D textures seems right, inputting…
billvh
  • 57
  • 5
3
votes
1 answer

Questions about the second parameter of glBufferData in webgl

I been reading the famous webgl tutorial https://webgl2fundamentals.org/webgl and learning how to use bufferData to put data into the buffer. The tutorial uses bufferData in the form like this extensively gl.bufferData(gl.ARRAY_BUFFER, new…
Joji
  • 4,703
  • 7
  • 41
  • 86
3
votes
1 answer

WebGL 2.0: Draw call succeeds even VBO is deleted

So I am using a VAO to store pointers from a VBO. I wanted to test what happens when I delete my data buffers (vbo, ibo, etc.) before binding the VAO and calling a draw. Since VAOs store pointers to the data in the corresponding data buffers, I…
SuperTasche
  • 479
  • 1
  • 7
  • 17
3
votes
1 answer

gl_FragData must be constant zero

I'm having an issue trying to compile a fragment shader. I keep getting this error: Uncaught Error: Fragment Shader Compiler Error: ERROR: 0:21: '[' : array index for gl_FragData must be constant zero ERROR: 0:21: '[' : array index for gl_FragData…
James Wilkins
  • 6,836
  • 3
  • 48
  • 73
1 2
3
26 27