Three.js: BufferGeometry drawRange influence both face index & other vertices properties

Created on 31 Oct 2018  路  7Comments  路  Source: mrdoob/three.js

BufferGeometry drawRange influence both face index & other vertices properties

The drawRange influence both face indexing & vertex attributes such as position.

For exemple if my index use the vertex 0 to 10, I was expecting setDrawRange( 0, 30 ) will do the job, but actually if I have more than 10 face indexed, then the extra face after the 10 first will not be draw,

I wonder if its a Webgl limitation or if we can separated setDrawRange in two function setVertexDrawRange & setIndexDrawRange.

Three.js version
  • [x] r98
Browser
  • [x] All of them
OS
  • [x] All of them

Most helpful comment

I wonder if its a Webgl limitation or if we can separated setDrawRange in two function setVertexDrawRange & setIndexDrawRange.

It is a WebGL limitation indeed. DrawRange maps to gl.drawElements() and gl.drawArrays()

All 7 comments

For non-indexed BufferGeometry, count in setDrawRange( start, count ), is the number of vertices.

For indexed BufferGeometry, count in setDrawRange( start, count ), is the number of indices.

I wonder if its a Webgl limitation or if we can separated setDrawRange in two function setVertexDrawRange & setIndexDrawRange.

I do not vote for this. Having a single function setDrawRange() is the better approach from my point of view.

Thanks for the clarification about it. Also I agree a general setDrawRange is good but cant we have the tree : setDrawRange with the general behavior describe by WestLangley & the two others for deeper control ?

cant we have [three] : setDrawRange with the general behavior describe by WestLangley & the two others for deeper control ?

I expect that would be too confusing.

Perhaps you can use geometry.addGroup() for additional control in your app:

geometry.clearGroups();
geometry.addGroup( start, count, 0 );
material = [ material ]; // if there is just one material

@WestLangley So the param start/count in addGroup are about index for indexedGeometry & vertex for non indexed too?

I'm not sure if this will resolve my needs about discarding by face & vertex at the same time. but thanks to your explanation, I already solved my original problem, this extra control isnt really need anymore.

I suggest to clarify the documentation with your explanation :)

I suggest to clarify the documentation with your explanation :)

Done!

I wonder if its a Webgl limitation or if we can separated setDrawRange in two function setVertexDrawRange & setIndexDrawRange.

It is a WebGL limitation indeed. DrawRange maps to gl.drawElements() and gl.drawArrays()

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yqrashawn picture yqrashawn  路  3Comments

Horray picture Horray  路  3Comments

seep picture seep  路  3Comments

scrubs picture scrubs  路  3Comments

ghost picture ghost  路  3Comments