When is data sent into the pipeline?

I’ve been coding OpenGL purely by example, and I’m at the point where I want (and need) to understand what I’m doing rather than just mimic code. :frowning: Especially considering the project I’m working on. . .

A simple question then:

What function actually sends data into the pipeline? gEnd()? In the simplest program I can create, it looks like it’s either that or SwapBuffers(). The latter seems like an unlikely function for sending all the data, but I don’t want to assume anything.

GL implementations typically maintain a buffer of commands as you call API. When the buffer is full, it will be flushed, starting the pipeline.

If you think about that, it means any command can potentially start the pipeline, and you can’t tell which, because the size of the command buffer is unknown to you (it may even resize dynamically.)

Certain API does force commands to execute, i.e. glFlush() or SwapBuffers(). Or any command that needs rendering results visible back on the CPU, like (non-PBO) glReadPixels or (non-async) glMapBuffer. You should not depend on glEnd() to force execution.

Interesting, and good to know! Thanks! :slight_smile: