Is there a limit of vertices in WebGL?

后端 未结 6 2175
梦毁少年i
梦毁少年i 2020-12-08 04:27

Three.js says that can\'t be loaded more than 65k vertices. In my pure webgl application, it doesn\'t say anything, but it doesn\'t show the entire object when I try big obj

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 05:14

    As far as I know, this is usually limited by the hardware and/or driver software (hardware is using 16-bit indices or such). Maybe Three.js just plays it safe and tries to makes sure your webgl-app works on all cards. Probably the best way is to break your models down into smaller chunks, this will make sure your app supports most if not all GPUs in use today.

    • Using immediatemode (glBegin...glEnd), there is no restriction in the amount of vertices you can push through, but it's going to be slow with that many vertices.
    • You could try using glGetIntegerv() with GL_INDEX_BITS, GL_MAX_ELEMENTS_VERTICES and GL_MAX_ELEMENTS_INDICES to query the amount of index bits, maximum vertices and maximum indices the card/driver supports.
    • If I remember correctly, Vertex Arrays and VBOs (Vertex Buffer Object) both have similar limits (on the same card/driver), so switching between them probably won't help (not 100% sure on this)

提交回复
热议问题