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:
...
15
votes
Accepted
GL_STATIC_DRAW vs GL_DYNAMIC_DRAW vs GL_STREAM_DRAW: does it matter?
This will vary between implementations, but the driver I worked on did use these, mainly to decide memory layout. The optimizations enabled by these hints are much smaller than you would like, mainly ...
8
votes
GL_STATIC_DRAW vs GL_DYNAMIC_DRAW vs GL_STREAM_DRAW: does it matter?
Functionally they are the same.
The driver could use them to differentiate how to handle the buffer behind the scenes. Where for example static_draw would be copied to vram as soon as possible and ...
7
votes
Accepted
What is an OpenGL VAO in a nutshell?
tl;dr The vao caches the calls to glVertexAttribPointer et. al.
Every call to glVertexAttribPointer, ...
7
votes
Accepted
Label Placing for thousands of objects with OpenGL
Since you are new to computer graphics, you may be better off avoiding the complications of SIMD and sticking with the traditional 'create a CPU thread + collect results' approach, or even run in the ...
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....
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 ...
5
votes
OpenGL VertexArray Data "Retention"?
Deleting an OpenGL object is merely a suggestion. Deleting an object will unbind the object from any binding point it is currently bound to. However, buffer objects are not "bound" to VAOs. They are ...
5
votes
Accepted
Multiple VAO share a VBO
VAO can share VBO's because they do not store vertex data itself but references to Vertex Buffer Objects.
So you can first generate your buffers and upload your buffer data (vertex data and index ...
5
votes
How glVertexAttribPointer works?
A VAO holds the attribute information. This means that for each attribute it has a buffer, offset, size, type, stride and whether it's normalized. Separately from those is the element buffer binding ...
5
votes
Accepted
Dx12 Vertex Buffer incorrect
Vector has a few different semantics from static arrays. For one it's a struct containing a pointer a capacity and a length (at the very least). That means that ...
5
votes
Accepted
Vulkan: efficient way to update VBO mesh vertices?
With OpenGL I would have to reload whole vertex VBO's.
No you wouldn't. You can use glBufferSubData
I suppose with Vulkan there could be a way to directly ...
5
votes
Accepted
Are vertices of each LOD version always loaded into VRAM
Many game engines have texture streaming, which means that not all mip levels of each texture are loaded at all times. The game engine will track which textures are in view and how close up they are ...
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.
...
4
votes
Accepted
How glVertexAttribPointer works?
How I call glVertexAttribPointer for the GL_ELEMENT_ARRAY_BUFFER buffer?
You don't. The element array buffer is used to store vertex indices, not vertex attribute data and therefore it doesn't have ...
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.
...
4
votes
Accepted
Replacing Vertex Attributes (glBufferData vs glBufferSubData)
There is a difference between "can" and "should".
You "should" not use glBufferData to change the size of an existing non-immutable buffer. You can still do so, ...
3
votes
What is an OpenGL VAO in a nutshell?
VAOs are essentially 'plumbing' objects that help get data from your buffers into your vertex shader ready for drawing. On the GPU this is handled by the vertex fetch stage, so a VAO is basically just ...
3
votes
Can one VAO store multiple calls to glVertexAttribPointer?
In version 4.3+ the vao layout can be set independently from the VBO buffer which allows you to rebind the vbo without having to call vertexAttribPointer every time:
...
3
votes
Accepted
Attribute Location in Multiple Shader Programs
Each VAO, and shader for that matter, has a separate space of attribute locations. It's perfectly fine to have multiple shaders use the same attribute locations. Indeed, it's a good idea to do so if ...
3
votes
Accepted
Multiple buffers and calling glBufferSubData
It depends. There are a few competing factors at work here.
First, consolidating terrain data into fewer buffers (or one) may allow you to combine multiple terrain patches together in a single draw ...
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 ...
3
votes
Accepted
Different Vertex structures in multi-purpose system
Most rendering engines do need to handle multiple vertex structures depending on the type of shading being used on the mesh.
If there are only a small number of discrete vertex structures, you could ...
2
votes
How to encode/decode buffer data in glTF?
In addition to @russ' answer, I was able to decode the buffer with the gltf Utilities.
...
2
votes
Accepted
How to encode/decode buffer data in glTF?
The information you're looking for is defined in the 'accessors' and 'bufferViews' near the top of the source file you linked.
Bufferviews simply divide the buffer up into sub ranges and define ...
2
votes
Accepted
Is it possible to store the plain buffer data in gltf files?
It's not possible to store the plain text array buffers in gltf, however, here is the code I use to generate buffers in JavaScript:
...
2
votes
Accepted
Sharing calculation result between shader programs in OpenGL
Yes you can, this is how deferred rendering for example would work. For that you would render to a texture in one pass, in openGL this would be via an FBO, then feed that texture as the input to the ...
2
votes
Accepted
Can one VAO store multiple calls to glVertexAttribPointer?
Yes, VAO state includes vertex attribute specification for multiple attributes. Each attribute has its own format information and can come from a distinct buffer object. That's part of why you can ...
2
votes
Accepted
Passing Colour from program to vertex shader
I don't know what language that is, but I'm going to hazard a guess that the arrays points and gl.Ptr([]float32{0.5,0.5,0.0}) ...
2
votes
Accepted
Role of gl.vertexAttrib
gl.vertexAttribPointer is used when different vertices should have different values, and gl.vertexAttrib is used when all vertices should have the same values, and you don't want to use a special ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vertex-buffer-object × 42opengl × 23
buffers × 8
shader × 7
c++ × 6
webgl × 5
rendering × 4
data-structure × 4
gltf × 4
3d × 3
gpu × 3
performance × 3
glsl × 1
mesh × 1
geometry × 1
vulkan × 1
matrix × 1
compute-shader × 1
image × 1
fragment-shader × 1
directx12 × 1
directx11 × 1
optimisation × 1
line-drawing × 1
mapping × 1