index-buffer

OpenGL - auto generation of indices / stride parameter for glDrawArrays

爱⌒轻易说出口 提交于 2019-12-09 23:00:50
问题 I'm rendering a grid-structure with lots of data-points (>1M). The structure of my data is in the picture. So the content of my index buffer looks like this 0, 100, 1, 101, 2, 102, 3, 103, ... I'm a bit annoyed by the huge size of my index-buffer which I need to define my triangle strip. Is there a possibility to tell OpenGL to generate these indices automatically in the showed way? Or maybe some trick with glVertexAttribPointer I haven't though of? 回答1: There is indeed a function for

OpenGL - auto generation of indices / stride parameter for glDrawArrays

百般思念 提交于 2019-12-04 17:17:19
I'm rendering a grid-structure with lots of data-points (>1M). The structure of my data is in the picture. So the content of my index buffer looks like this 0, 100, 1, 101, 2, 102, 3, 103, ... I'm a bit annoyed by the huge size of my index-buffer which I need to define my triangle strip. Is there a possibility to tell OpenGL to generate these indices automatically in the showed way? Or maybe some trick with glVertexAttribPointer I haven't though of? There is indeed a function for something like this: glDrawElementsBaseVertex so you can draw them all with: for(int i=0; i < height-1; i++){