pex-renderer icon indicating copy to clipboard operation
pex-renderer copied to clipboard

Changing geometry buffer type on the fly

Open vorg opened this issue 7 years ago • 2 comments

We initialize geometry component with a cube that defaults to Uint16 index buffer. Updating geometry with high poly mesh and switching to Uint32 index buffer (or from 32 to 16) crashes as we try to update buffer assuming old type.

We need to detect the change of type and recreate the buffer.

Maybe geometry should auto-guess based in positions length? Or always switch to Uint32 if available?

Related Invalid index buffer type

vorg avatar Aug 20 '18 09:08 vorg

That's actually problem with any attribute. Eg. we initialize geometry with cube that has texCoords and then we want to render something without we will get wrong attribute for texCoords as they will not be updated.

vorg avatar Aug 20 '18 11:08 vorg

The bigger issue / pattern is how to distinguish between updating geometry and replacing geometry (with potentially different attribute set)

vorg avatar Aug 20 '18 12:08 vorg