Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Direct state access for draw* functions?

Tags:

opengl

Now that we have direct state access I wonder why there are no updated glDraw* DSA functions.

For example glDrawArrays is dependent to the current VAO, so why is there no glNamedDrawArrays?

Do I still have call

glBindVertexArray(vao);
glDrawArrays(..);

or is there another way?

like image 317
Maik Klein Avatar asked Jan 06 '15 01:01

Maik Klein


1 Answers

glDraw* is just tell OGL to draw something under current context and that maybe related many states like Shader, Blender, VBO/VAO, Z/Stencil, Texture, etc.. Even a tiny change may bring different render result, so you can image DSA glDraw* will be a long function parameter list, that's not good. For example, you want to change cull face from CW to CCW, maybe you need to find the corresponding parameter in a long function call, and change it. Be note, OGL is most C-like, and default parameter feature of function is limited, each time you call DSA glDraw*, you need to have a long function call with most same values, that will make you crazy.

As @Andon M. Coleman mentioned, DSA aimed for reduce the call sequence of general OGL function call type: bind->modify->unbind, and DSA only need 1 API call. That will reduce the CPU time, especial you have a very large OGL API calls.

Thanks An

like image 99
Yan An Avatar answered Nov 01 '22 02:11

Yan An