Code Monkey home page Code Monkey logo

Comments (2)

dekdevy avatar dekdevy commented on September 18, 2024

I figured that this is merely an issue within OGL and not related to the WebGL extensions.
The Primitive generators generate index buffers of type Uint16Array and hence assume that the index array will never need to hold integers above 2^16, which is rather conservative.

The following lines could be enhanced with a ternary to check for the required array type and hence solve the issue relatively elegantly without defaulting to Uint32Array.

In any primitive generator class:
const index = new Uint16Array(numIndices * 6);
We could check whether the maximum possible index value will go over 2^16, and if so generate a Uint32Array.

In the geometry.js file:
attr.type = attr.type || (key === 'index' ? this.gl.UNSIGNED_SHORT : this.gl.FLOAT)
We need to make sure that if the index array is 32bit, this.gl.UNSIGNED_INT is passed in.

from ogl.

gordonnl avatar gordonnl commented on September 18, 2024

Thanks a lot for your detailed explanation. Great addition.

from ogl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.