OGL-TypeScript is a comprehensive TypeScript port of the minimal WebGL library, OGL, designed to enhance development with robust type definitions and essential code completion. Currently stable at version 0.1.40, it meticulously tracks the releases and API changes of its upstream counterpart, OGL (currently mirroring OGL 0.0.71). The library's core focus is to provide a lightweight and unopinionated foundation for building high-performance 3D graphics directly with WebGL in the browser. Its key differentiators include a significantly small bundle size, direct and low-level access to WebGL APIs, and the added benefit of TypeScript's type safety, which makes managing complex WebGL shaders and rendering pipelines more efficient and less prone to runtime errors compared to plain JavaScript OGL. The release cadence is tightly coupled with OGL's updates, typically seeing new minor versions released to align with new OGL features, fixes, or API refinements.
npm install ogl-typescriptVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes a WebGL renderer, sets up a camera, creates a simple 3D plane geometry, defines a basic shader program, and renders a spinning mesh on a canvas, demonstrating core OGL-TypeScript usage.
Always consult the release notes of the corresponding OGL version that ogl-typescript mirrors (as listed in the versions table in the README) for details on API changes and migration steps when updating.
Ensure the HTML canvas element is correctly created and appended to the DOM before initializing the Renderer. Verify `renderer.gl` is a valid WebGLRenderingContext after instantiation to confirm context creation.
Thoroughly review your vertex and fragment shader code for GLSL syntax correctness. Utilize browser developer tools (e.g., Chrome's 'WebGL' tab) for detailed shader compilation logs and error messages.
Ensure `document.createElement('canvas')` successfully creates an element and it's appended to the DOM, or pass an existing, valid canvas element (e.g., `canvas: document.getElementById('my-canvas')`).Review the `ogl-typescript` type definitions or documentation (or the original OGL documentation) to verify the correct symbol name and its export status. Ensure case sensitivity is respected.
Check the version compatibility between your `ogl-typescript` package and the corresponding OGL version's API documentation. Update your code to reflect the current API, or consider upgrading `ogl-typescript` if the feature was added recently.
No dependency data recorded yet.