PDA

View Full Version : When is data sent into the pipeline?



paradoxresolved
02-04-2014, 08:00 PM
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. :( 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.

arekkusu
02-04-2014, 09:39 PM
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.

paradoxresolved
02-04-2014, 09:54 PM
Interesting, and good to know! Thanks! :)