Skip to content

Latest commit

 

History

History
74 lines (62 loc) · 2.11 KB

README.md

File metadata and controls

74 lines (62 loc) · 2.11 KB

RedGPU

RedGPU - Javascript WebGPU Library

Twitter Follow

RedGPU V1.x

  • See the example. Various examples are available.
RedGPU.-.Examples.-.Chrome.2021-12-11.17-50-26.mp4

Usage

  • When running localhost, port 3003 should be used.
  • Running in chrome canary.

html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>RedGPU Example - HelloWorld</title>
    <link type="text/css" rel="stylesheet" href="../css.css"/>
    <script type="module" src="your host.js"></script>
</head>
<body></body>
</html>

module

"use strict"
import RedGPU from "dist/RedGPU.min.mjs";

const cvs = document.createElement('canvas');
document.body.appendChild(cvs);
new RedGPU.RedGPUContext(
	cvs,
	function () {
		let tView, tScene, tCamera;
		let renderer, render;
		let testMesh;
		tScene = new RedGPU.Scene();
		tCamera = new RedGPU.Camera3D(this);
		tView = new RedGPU.View(this, tScene, tCamera);
		renderer = new RedGPU.Render();
		this.addView(tView)

		testMesh = new RedGPU.Mesh(this, new RedGPU.Box(this), new RedGPU.ColorMaterial(this))
		tScene.addChild(testMesh)

		tCamera.z = -5;
		tCamera.lookAt(0, 0, 0);

		render = time => {
			renderer.render(time, this)
			requestAnimationFrame(render)
		}
		requestAnimationFrame(render);
	}
);

RedGPU 2.0 research progress.

V2.0.0 research is ongoing. Other repositories are in the works and will be released as meaningful work progresses.
The first target will be released on December 1, 2022.