16 votes
Accepted

What is an index buffer and how is it related to vertex buffers?

Could someone ELI5 to me, what is an index buffer and how is it related to vertex buffers Your vertex buffer contains the X and Y coordinates of 5 vertices. They are: ...
Rotem's user avatar
  • 443
7 votes

Can a scene graph be stored in the GPU?

Short answer: Yes, It can be done. But no one does so. Long answer: Scene graphs can be stored and processed on a GPU using OpenCL/WebCL. But it is not practical to do so. Updating scene graphs (a ...
Mary Chang's user avatar
7 votes

Fading particles and transition

I made a visualization a little like yours years ago, and used a similar technique, because it's the natural approach to the problem. After I spent a few years writing drivers for modern GPUs, I ...
Dan Hulme's user avatar
  • 6,810
7 votes
Accepted

Why does substracting -1 in shader fail for a float data type?

Without seeing the error message I can't be sure but I think it's failing on the 1 being int instead of a float. float inv_coord = v_coord - 1.0; There is a ...
ratchet freak's user avatar
6 votes

What is an index buffer and how is it related to vertex buffers?

If you have a vertex buffer like this: var vertices = [ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.6, 0.0, 1.0, 0.6, 0.0, 0.5, 1.0, 0.0 ] And simply draw it ...
q9f's user avatar
  • 703
6 votes

Is it possible to create minimal glTF files with vertex and index buffers?

While creating a set of glTF models for a tutorial, I also intended to create THE minimal glTF file. Update: The following referred to glTF 1.0/1.1. See below for an update of this example to glTF 2....
Marco13's user avatar
  • 218
6 votes

What actually happens in frame buffer when an image or document is scrolled?

In the olden days of text-mode terminals, the "frame buffer" was a buffer of text, not an image. Scrolling worked in the way you described. The buffer was larger than would fit on the screen, and to "...
Dan Hulme's user avatar
  • 6,810
5 votes
Accepted

How to use 32 bit Integers for Element Indices in WebGL 1.0?

Enabling the extension is as simple as: var uints_for_indices = gl.getExtension("OES_element_index_uint"); if ...
ratchet freak's user avatar
5 votes
Accepted

Can we use PhysX in WebGL?

PhysX is a C++ API and can thus not directly be integrated with the JavaScript-based WebGL. Depending on your needs, you have the following options: Use a JavaScript-based physics engine, mostly ...
David Kuri's user avatar
  • 2,293
4 votes

Is it possible to create minimal glTF files with vertex and index buffers?

You can put the data into a data uri to store the data inline in base64 format. ...
ratchet freak's user avatar
4 votes

Is it possible to store the plain buffer data in gltf files?

Embedding human readable data is not supported. However you can put the data into a data uri to store the data inline in base64 format. ...
ratchet freak's user avatar
4 votes
Accepted

Rendering same vertex-array in different modes

Your shaders are fine, the problem is topological, that is the way the vertices are connected to create triangles. For cases 1 & 2: You cannot really draw a grid of points in this mode (...
PaulHK's user avatar
  • 2,322
4 votes
Accepted

Optimizing performance on hardware

Although you may be able to detect what hardware is available as a first approximation of a computer's capability, depending on this might not be useful since the same hardware may behave differently ...
trichoplax is on Codidact now's user avatar
4 votes

WebGL: Why are my textures black?

Okay, I figured it out. It has to do with the texture not loading before the first display function is called. The texture displays after a mouse or keyboard event. To remedy this, I added a timer to ...
mago3421's user avatar
4 votes
Accepted

Inverse matrix order of operation

Yes. If you're compounding operations to make a matrix, then the inverse matrix will be the compound of the inverse operations, in the reverse order. So if $C = AB$ then $C^{-1} = B^{-1}A^{-1}$ Think ...
russ's user avatar
  • 2,392
4 votes
Accepted

Triangulation of vertices of an ellipsoid

If you sample the two parameters $\eta$ and $\omega$ with steps $d\eta$ and $d\omega$, then you'll get a grid of points $v_{ij} = f(i\;d\eta,j\;d\omega)$. Any four adjacent points will define a ...
gilgamec's user avatar
  • 901
4 votes
Accepted

Does WebGL 2 support linear depth texture sampling?

The spec says depth textures are not filterable. 3.8.13 ... Using the preceding definitions, a texture is complete unless any of the following conditions hold true: The effective ...
gman's user avatar
  • 214
3 votes
Accepted

How to know when rendering is complete in WebGL?

You can utilize ARB_sync or in other words sync objects which have been core since 3.2. From the point-of-view of OpenGL then right after issuing a specific command (you want to know whether has ...
vallentin's user avatar
  • 251
3 votes
Accepted

What happens to float values written to UNSIGNED_BYTE texture?

Unsigned byte textures in a graphics API are usually "normalized"—the byte values are interpreted as ranging from 0.0 to 1.0, with a byte of 255 mapping to 1.0. So no, they aren't truly floating-point ...
Nathan Reed's user avatar
3 votes

Need help reasoning about video oscillation >60hz

Yeah, that makes sense. Most flat panel monitors on the market have a 60Hz refresh rate! So you are not going to be able to flicker faster than 60Hz due to technical limitation. Were you to do this ...
joojaa's user avatar
  • 8,437
3 votes
Accepted

Emission of light from texture on WebGL

Presumably you are using a lighting system already, let's say Lambert shading for simplicity.. So we have a texture which is going to be illuminated by some light source. The following psuedo/shader ...
PaulHK's user avatar
  • 2,322
3 votes

Unable to render a Waveront model in WebGL2

The problem is with how wavefront files and OpenGL work with indices. OpenGL OpenGL allows you to have different buffers, allowing your vertex to have multiple attributes. However, for every vertex ...
bram0101's user avatar
  • 1,605
3 votes

Only show opaque objects behind transparent objects

The simplest solution is to do three passes: Render opaque meshes to a buffer (front-to-back, depth read/write on) Render translucent meshes to another buffer (front-to-back, depth read/write on) ...
Syntac_'s user avatar
  • 561
3 votes
Accepted

Is it possible to create minimal glTF files with vertex and index buffers?

After spending a hard time to understand the way how the binary buffers work in the gltf files I finally managed to generate a truely minimal gltf file. It's a single yellow triangle (demo). I tried ...
q9f's user avatar
  • 703
3 votes

What is the technique to generate an oblique 3d cone?

The general equation for a upright cone with the tip at $Z=0$ is $$ 0 = X^2 + Y^2 - Z^2$$ (Ignoring the points for which $Z>0$). If you consider slices for some constant $Z$ you get circles ...
flawr's user avatar
  • 246
3 votes
Accepted

Problems rendering a plane via `drawElements`

This looks like a case of 16bit truncation in your indice buffer. For a 257x257 grid you will be addressing more than 65536 vertices so you will need to use a 32bit indice buffer. ...
PaulHK's user avatar
  • 2,322
3 votes
Accepted

Is there a better, more elegant way of translating/rotating my camera in my 3d raymarched world or am I stuck with trigonometry?

A reliable way of getting the forward/left directions relative to the view is to use the camera rotation matrix itself to produce forward, Up and right vectors. ...
PaulHK's user avatar
  • 2,322
3 votes
Accepted

Ray Tracing With Continuous Refraction

You can refer to the available literature on the topic. The papers I am aware of are: Ray Tracing in Non-Constant Media and Interactive Rendering of Non-Constant, Refractive Media Using the Ray ...
lightxbulb's user avatar
  • 2,226
3 votes
Accepted

Move the camera in orthographic 3D

It seems that some basic computer graphics knowledge is missing. Normally you have two matrices for the camera (viewMatrix and projectionMatrix), both are 4x4 matrices. The viewMatrix stores the ...
Thomas's user avatar
  • 1,265

Only top scored, non community-wiki answers of a minimum length are eligible