Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between glEnable and glEnableClientState?

Tags:

opengl

What is the difference between glEnable and glEnableClientState? Every time I need a mode set/unset I have to look at the reference to know which of those will accept it. Os there any general rule which says what modes goes into which one?

like image 329
Dani Avatar asked Oct 14 '11 19:10

Dani


3 Answers

In addition to tibur's answer, in practice the only use of glEnableClientState and glDisableClientState is for enabling/disabling the builtin fixed-function attribute arrays (like GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, ...). For all other states you use glEnable and glDisable (or glEnableVertexAttribArray and glDisableVertexAttribArray for the generic vertex shader attributes).

like image 126
Christian Rau Avatar answered Nov 15 '22 12:11

Christian Rau


glEnable is used for the set of state that the OpenGL ARB determined represented internal driver state. glEnableClientState is for state that represents information that you more directly control. The only client state that existed to be enabled/disabled were the old vertex array states. And those were superceeded by glEnable/DisableVertexAttribArray.

The distinction is really quite meaningless since the driver still manages all of this state.

like image 37
Nicol Bolas Avatar answered Nov 15 '22 13:11

Nicol Bolas


glEnable are server side while glEnableClientState are client side. Think at server side as you CPU and client side as your GPU. Globally, vertex arrays only are client side.

like image 38
tibur Avatar answered Nov 15 '22 13:11

tibur