Skip to content

Minimal WebGL2 thin library for creating 3D graphics

License

Notifications You must be signed in to change notification settings

GelamiSalami/Toymi.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toymi.js

Minimal WebGL2 thin library for prototyping 3D graphics

Usage

Basic Example

import { ExampleShader } from "./shaders/ShaderSources.js";
import { ShaderProgram, Mesh, Utils } from "../build/toymi.module.min.js";

const canvas = document.getElementById("main-canvas");
const gl = canvas.getContext("webgl2", { antialias: false });

const program = new ShaderProgram(gl, ExampleShader.vertex, ExampleShader.fragment);
const mesh = Mesh.createFullscreenMesh(gl, program);

function render(currentTime) {
	if (Utils.resizeCanvasToDisplaySize(gl.canvas)) {
	}

	gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);

	program.use();

	program.setUniform("uTime", currentTime / 1000);

	mesh.draw();

	requestAnimationFrame(render);
}
requestAnimationFrame(render);

About

Minimal WebGL2 thin library for creating 3D graphics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published