sebcrozet / kiss3d

Keep it simple, stupid 3d graphics engine for Rust.
http://kiss3d.org
BSD 3-Clause "New" or "Revised" License
1.5k stars 173 forks source link

Weird rendering problem when quad usubdivs and vsubdivs are over 255 #163

Open riekkuja opened 5 years ago

riekkuja commented 5 years ago

It seems that quads don't render correctly if both usubdivs and vsubdivs are set to over 255. Here is a screenshot what happens with quad example code when quad is created like: let mut c = window.add_quad(5.0, 4.0, 500, 260); screenshot from 2019-02-22 18-02-06

If I lower usubidvs OR vsubdivs value to under 130 everything works as expected.

sebcrozet commented 5 years ago

Hi!

Because of our comptability with WebGL 1.0, The number of vertices addressable by the mesh's index buffer is limited to 2^16. So you will get weird results whenever the quad has more than 2^16 vertices.

The solution is to split the quad into smaller ones and this is currently not done automatically by Kiss3d.