Skip to main content
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, ...
ratchet freak's user avatar
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 ...
Nicol Bolas's user avatar
  • 9,792
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 ...
Dan Hulme's user avatar
  • 6,810
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
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 ...
Chifti Saidi's user avatar
5 votes

Compute shaders: one-time-only versus persistent buffers

Yes, it's totally possible, and in fact it's preferable to keep buffers in memory if you will be accessing them over the life of your program, rather than deallocating and reallocating them again. I ...
russ's user avatar
  • 2,392
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 ...
Kevin Reid's user avatar
  • 1,106
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 ...
russ's user avatar
  • 2,392
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, ...
Nicol Bolas's user avatar
  • 9,792
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 ...
aces's user avatar
  • 1,353
4 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-...
Nicol Bolas's user avatar
  • 9,792
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
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 ...
AverageGatsby's user avatar
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 ...
Nathan Reed's user avatar
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

Use big frame buffer to control a small display

As stated, the question is a bit generic. It all depends on what part you want to display in the 512x512 display. If you have a 1024x1024 frame buffer from some source and only want to display 1/4 of ...
Paul-Jan's user avatar
  • 266
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. ...
q9f's user avatar
  • 703
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 ...
russ's user avatar
  • 2,392
2 votes
Accepted

How to generate binary gltf array buffers?

I've finally managed to write the buffers myself using JavaScript. The result is a base64 encoded String, like: ...
q9f's user avatar
  • 703
2 votes

How to generate binary gltf array buffers?

Technically any file format where you can dump the entire file into a VBO and then render from that will work for the .bin files. Unfortunately those formats are less well known than they should be. ...
ratchet freak's user avatar
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 ...
Nathan Reed's user avatar
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 ...
Christian Rau's user avatar
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 ...
pmw1234's user avatar
  • 3,219
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 ...
Nathan Reed's user avatar
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: <...
trojanfoe's user avatar
  • 121
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 ...
Nicol Bolas's user avatar
  • 9,792
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 ...
Nicol Bolas's user avatar
  • 9,792
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 ...
Nicol Bolas's user avatar
  • 9,792
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 &...
Nathan Reed's user avatar
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 ...
Nicol Bolas's user avatar
  • 9,792

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