I know that the OpenGL driver is implemented by hardware vendors, so this questions may not have a consistent answer.

If I use one of the glGet methods, does OpenGL get the information from the GPU or from the CPU?


1 Answer 1


It varies depending on the value you are getting. Some values come from files, such as values that are constant but GPU specific(inf files on windows if I remember correctly). Some come from the driver, run time values that are GPU specific. Some come from the GPU directly, values that are set directly or indirectly for a particular run.

How each driver implements all that is probably going to vary widely.

Values like the clear color and culling state are runtime, so the driver is going to be tracking it. The value will almost certainly be sitting on the user side so it won't incur a system call. (So that would be CPU) So it is very likely the driver will be able to fill the value directly.

  • $\begingroup$ I am interested into values like GL_COLOR_CLEAR_VALUE or GL_CULL_FACE which can be set during the execution. When enabling culling for example, does the driver (CPU side) hold this value, so when executing glIsEnabledi(GL_CULL_FACE, &dataToStoreValue); it can directly fill the variable? Or does the driver need to receive the value from GPU? $\endgroup$
    – Thomas
    Commented Feb 3, 2023 at 12:53
  • $\begingroup$ @Thomas: What does it matter? You shouldn't be asking for it anyway because you're the one who set it. You should already know the answer. If this is about performance, you shouldn't be using any get functions if performance matters to you. $\endgroup$ Commented Feb 3, 2023 at 14:48
  • $\begingroup$ @NicolBolas yes it is about performance and the CPU is pretty much idle. I'm working on a big project where these values change frequently (depending on material information). To avoid graphics errors, I compare the current state with the target state to change only the values that need to be changed. The OpenGL methods are used at the moment and I want to exclude performance degradation due to these method calls. $\endgroup$
    – Thomas
    Commented Feb 3, 2023 at 15:03
  • $\begingroup$ It is very important to check these states because the software must have a very high technology readiness level. Graphics errors must be avoided, otherwise the damage can be incredibly high $\endgroup$
    – Thomas
    Commented Feb 3, 2023 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.