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, ...
7
votes
Accepted
Binding vs bindless
When a shader accesses a resource (buffer or texture), it needs some information about that resource to be able to do so correctly. On a modern GPU, that information will generally just be some kind ...
6
votes
Accepted
How do double-buffers work in opengl?
Yes, the back buffer is for the GPU to write the frame that's in-progress, while the display controller sends the front buffer to the attached display. Swapping buffers doesn't really copy anything ...
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
How does the Communication between Monitor and GPU work?
In the typical case, the video card transmits all of the data in the image every frame (every refresh).
In the early days of television technology, it was impossible to do anything else; the display ...
5
votes
Accepted
In what scenarios and how does GL_ARB_buffer_storage help performance?
The marquee feature of buffer storage is not immutability of the allocation itself, but instead is a feature you couldn't have without immutable allocation: persistently mapped buffers.
Pre-...
5
votes
Accepted
How to solve Z buffer artifacts
Short answer: Move your near clip plane further away.
Depth buffer precision is very sensitive to the near clip plane distance.
Complicated answer: Use different math in your view projection. There ...
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
Z buffer working in OpenGL
When depth testing is enabled, the testing occurs after the fragment shader executes. The procedure is relatively simple (and spelled out pretty well here):
Get depth of fragment
Test against depth ...
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
Accepted
Sharing memory between compute shader and pixel shader
well, if anyone is stumbling across this and needs to know what solved it for me: We can bind a compute buffer to global shader memory if we just know what exactly we need to do
within the Compute ...
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 ...
2
votes
Accepted
Range of integers returned by glGenBuffers?
According to the OpenGL spec, any integer other than zero can be a potential name. Zero is the only value that's guaranteed not to be an object name.
Relevant quote from the spec:
2.6.1.1 Name ...
2
votes
OpenGL back and front buffer - counting and adjusting the number of red pixels before displaying to screen
I have tried doing glCear(GL_BACK_LEFT) between each iteration but it is not clearing, I'm wondering if I'm missing a line of code before the glClear, or if I'm calling it right. I think the problem ...
2
votes
How do you loop through the contents of a buffer in DX11?
There are a couple of issues. First you need to make sure that veBuffer has the correct type, so that probably means you need to cast it to pointer to vertex:
<...
2
votes
Accepted
What does the z-buffer look like in memory?
The Z buffer used to be specialized memory set aside for a single purpose, some web sites still explain it like that, but no longer.
Now the Z buffer is just a chunk of memory you allocate, or an API ...
2
votes
Accepted
fastest way to "read only" from buffer
I think you may be focusing on the wrong thing here. Moving the data from an SSBO to a uniform buffer might give some speedup, sure, but that is a micro-optimization.
I would search for algorithmic ...
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 ...
1
vote
What causes buffer access to be significantly slower in DXIL than SPIR-V?
Are you sure the buffer isn't just defined as a host visible buffer? If you allocate it in CPU space it might have to transfer it a lot, I use ByteAddressBuffer a lot and it's not that slow for me. So ...
1
vote
Is fragment shader run on fragments that are outside of rasterized geometry?
Broadly speaking, the way to deal with this is to check the depth value for that position on the screen. If the value is the value you cleared the depth buffer to, then you didn't write anything to ...
1
vote
Accepted
Using buffers correctly in OpenGL compute shaders
Do I could get event better perf by making it a compile-time constant ?
You'll have to profile it. That being said, "a few hundreds mat4" is not "small".
I have trouble ...
1
vote
Can the framebuffer in OpenGL jargon or its color buffer end up being the one and the same memory location as the one scanned by a display controller?
Can it be (eg. if I run a video game full-screen) that the compositor could simply declare the application's off-screen buffer the same as its 'screen buffer'
Yes. This is one of the things that &...
1
vote
Accepted
Multiple VAO share a EBO (OpenGL 3.3)
Your code is non-functional, but only because (in the core profile) you cannot bind a buffer to GL_ELEMENT_ARRAY_BUFFER unless a VAO is also bound. So the part that ...
1
vote
Feeding vertex data to a compute shader
You will need a new chunk of memory for the new surface anyway, so why not read from the original and store directly in the result.
Having precomputed normals will reduce a lot of the computation ...
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 "...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
buffers × 33opengl × 13
vertex-buffer-object × 7
compute-shader × 5
gltf × 5
vulkan × 3
memory × 3
gpu × 2
webgl × 2
fragment-shader × 2
data-structure × 2
frame-buffer × 2
z-buffer × 2
3d × 1
shader × 1
glsl × 1
c++ × 1
algorithm × 1
image-processing × 1
performance × 1
rasterizer × 1
image × 1
antialiasing × 1
animation × 1
directx12 × 1