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 ...
8
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, ...
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....
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 ...
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 ...
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, ...
4
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 ...
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 ...
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 ...
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
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:
...
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 ...
2
votes
Same draw call causing extremely different GPU usage under different triangle orders
I think you're seeing cache effects. The GPU will begin vertex processing for each strip in sequential order, and in configuration 1 the GPU will fetch a different chunk of memory for each triangle in ...
2
votes
Accepted
What does it mean for a buffer to be "tightly packed"?
To take an example from the glTF spec you cited:
The stride, in bytes, between vertex attributes. When this is not defined, data is tightly packed.
The stride of an array is the number of bytes from ...
2
votes
Which provides better intuition: THREE.Geometry or THREE.BufferGeometry?
Note that BufferGeometry still supports both indexed and non-indexed meshes. It contains arrays of vertex attributes and indices, and works in non-indexed mode if the indices array is null. You can ...
1
vote
Why are the transformations of an object calculated on CPU?
It is perfectly reasonable to do the multiplication on the GPU. The major reason it is taught this way is partly it is historically standard, but the main reason is if you have a vertex shader that ...
1
vote
Accepted
Passing non-interleaved data to glBufferStorage without using glBufferSubData
You can put your data in one piece of memory on the CPU and then copy it in with glBufferStorage. It's just a bunch of memcpy ...
1
vote
How does a Vertex Buffer manage memory?
There are various options, even with OpenGL 3.3 (over a decade old), that will depend on hardware factors, GPU, bus, etc., the driver-specific implementations, and finally, the sort of access patterns ...
1
vote
Accepted
Performance of particle implementation
Updating the position/rotation/scale in the vertex buffer will use less memory bandwidth—that’s 9 values, where a transform matrix would be either 12 or 16—and the GPU can parallelize the work of ...
1
vote
Accepted
Confusion about glVertexAttribPointer and non-active attributes
...have not been able to find much info about the link between programs and dynamic attribute bindings.
That is because there really is no link between them. Your vertex array data, i.e. the enabled ...
1
vote
What is an OpenGL VAO in a nutshell?
Buffer objects contain your vertex data. Vertex array objects tell OpenGL how to interpret that data. Without the VAO, OpenGL just knows that you suck some bytes into some buffers. The VAO says that "...
1
vote
How to read vertex color before rendering texture?
For this kind of functionality, you shouldn't try to use the same framebuffer for the vertex colours and for the final image. Don't forget that GL is asynchronous, so alternating CPU reads and GPU ...
1
vote
Accepted
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vertex-buffer-object × 42opengl × 23
shader × 8
buffers × 7
c++ × 5
webgl × 5
rendering × 4
data-structure × 4
gltf × 4
3d × 3
gpu × 3
performance × 3
mesh × 2
glsl × 1
geometry × 1
vulkan × 1
matrix × 1
compute-shader × 1
image × 1
uv-mapping × 1
fragment-shader × 1
directx12 × 1
optimisation × 1
line-drawing × 1
mapping × 1