简体   繁体   中英

OpenGL generating multiple vao buffer

Are there critical performance differences between

GLuint vao[2];
glGenVertexArrays(2, &vao);

// and

GLuint vao1[1], vao2[1];
glGenVertexArrays(1, &vao1);
glGenVertexArrays(1, &vao2);

I think of course latter one would have bad performance but due to my shallow understanding, I don't know how much would it be and why it's bad.

Not knowing how much vao the program will hold and be generating, is the latter one proper way to generate new VAO, keep generating size-one buffer? (ex: in the constructer of class)

You shound't imply those GLuint handles are stored in linear memory, and even if they are it doesn't mean the memory for objects those represent is continuous. It can be, or can be not during runtime, and it also depends on the access patterns you hint OpenGL when creating buffers. Graphic drivers do all that book keeping for you, including memory layout optimization. If you want to get an idea how drivers could potentially manage OpenGL objects and video memory, take a look at Vulkan API and best practices related to memory management . But again, in OpenGL you don't have that level of control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM