
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
gl-geometry
Advanced tools
A flexible wrapper for gl-vao and gl-buffer that you can use to set up renderable WebGL geometries from a variety of different formats.
A flexible wrapper for gl-vao and gl-buffer that you can use to set up renderable WebGL geometries from a variety of different formats.
Creates a new geometry attached to the WebGL canvas context gl.
Define or update an attribute value, for example using a simplicial complex:
var createGeometry = require('gl-geometry')
var bunny = require('bunny')
var geom = createGeometry(gl)
.attr('positions', bunny)
The following vertex formats are supported and will be normalized:
Arrays of arrays, e.g. [[0, 0, 0], [1, 0, 0], [1, 1, 0]].
Flat arrays, e.g. [0, 0, 0, 1, 0, 0, 1, 1, 0].
Typed arrays,
preferably a Float32Array.
1-dimensional ndarrays.
simplicial complexes,
i.e. an object with a positions array and a cells array. The former is
a list of unique vertices in the mesh (if you've used three.js, think
THREE.Vector3), and the latter is an index mapping these vertices to faces
(THREE.Face3) in the mesh. It looks something like this:
{
"positions": [
[0.0, 0.0, 0.0],
[1.5, 0.0, 0.0],
[1.5, 1.5, 0.0],
[0.0, 1.5, 0.0]
],
"cells": [
[0, 1, 2],
[1, 2, 3]
]
}
You can specify opt.size for the vertex size, defaults to 3.
You can update attribute values by calling attr again with the same name:
By default the entire contents of the associated gl-buffer are replaced by
data; the buffer will be resized accordingly.
Alternatively, you can pass opt.offset to copy data into the current
buffer at a specific offset (in bytes). In this case, the buffer cannot be
resized.
Pass a simplicial complex's cells property here in any of the above formats
to use it as your index when drawing the geometry. For example:
var createGeometry = require('gl-geometry')
var bunny = require('bunny')
bunny.normals = normals.vertexNormals(
bunny.cells
, bunny.positions
)
var geom = createGeometry(gl)
.attr('positions', bunny.positions)
.attr('normals', bunny.normals)
.faces(bunny.cells)
You can specify opt.size for the cell size, defaults to 3.
Binds the underlying VAO – this must
be called before calling geom.draw. Optionally, you can pass in a
gl-shader to
automatically set up your attribute locations for you.
Draws the geometry to the screen using the currently bound shader.
Optionally, you can pass in the drawing mode, which should be one of the following:
gl.POINTSgl.LINESgl.LINE_STRIPgl.LINE_LOOPgl.TRIANGLESgl.TRIANGLE_STRIPgl.TRIANGLE_FANThe default value is gl.TRIANGLES. You're also able to pass in a start and
stop range for the points you want to render, just the same as you would
with gl.drawArrays or gl.drawElements.
Unbinds the underlying VAO. This must be done when you're finished drawing, unless you're binding to another gl-geometry or gl-vao instance.
Disposes the underlying element and array buffers, as well as the VAO.
MIT. See LICENSE.md for details.
FAQs
A flexible wrapper for gl-vao and gl-buffer that you can use to set up renderable WebGL geometries from a variety of different formats.
We found that gl-geometry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.