Do opengl functions prevent freezing of the main thread?

So, when you call opengl functions like glDraw or gLBufferData, does the program thread stop and wait for GL to complete the calls?

If not, how does GL handle important functions like glDraw, and then immediately after changing the setting, which affects drawing calls?

+5
source share
2 answers

No, they (mostly) do not. Most GL functions are buffered when used and are actually executed later. This means that you cannot think about the processor and the GPU, since two processors work simultaneously. Typically, the CPU performs a bunch of GL functions that receive buffering, and as soon as they arrive at the GPU, they execute them. This means that you cannot reliably control how much time it took to perform a specific GL function, simply comparing the time before and after its execution.

, glFinish(), GL, , , , glFinish , , , .

, " ". , , , .

edit: , , : , , ,

+6

OpenGL OpenGL. OpenGL, , . OpenGL . , , OpenGL , .

OpenGL (, ..) , OpenGL, . , , :

glBindTexture(GL_TEXTURE_2D, texID);

glTexImage2D(..., image_1);
draw_textured_quad();

glTexImage2D(..., image_2);
draw_textured_quad();

draw_textured_quad , . , , OpenGL , . , glTexImage2D , , , OpenGL , texID draw_textured_quad. glTexSubImage2D, .

OpenGL , , OpenGL. , OpenGL OpenGL , , . , , .

+1

All Articles