Forget all that module noise

This commit is contained in:
Brandon Dyck 2022-10-22 12:08:26 -06:00
parent 16271a79b5
commit c83ea2e7c3
2 changed files with 55 additions and 55 deletions

View File

@ -1,14 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script type="module" src="panorama-viewer.js"></script>
<script type="module">
import { render } from "./panorama-viewer.js";
window.addEventListener("load", () => {
let viewer = document.getElementById("viewer");
render(viewer);
});
</script>
<script src="./panorama-viewer.js"></script>
</head>
<body>
<h1>Panorama Viewer</h1>

View File

@ -1,6 +1,12 @@
"use strict";
(() => {
window.addEventListener("load", () => {
let viewer = document.getElementById("viewer");
render(viewer);
});
export const render = (canvas) => {
let gl = canvas.getContext("webgl");
const render = (canvas) => {
let gl = canvas.getContext("webgl2");
const vShaderSrc = `
attribute vec3 position;
@ -53,4 +59,5 @@ export const render = (canvas) => {
gl.enableVertexAttribArray(positionLocation);
gl.vertexAttribPointer(positionLocation, 3, gl.FLOAT, false, 4*3, 0);
gl.drawArrays(gl.TRIANGLES, 0, 3);
}
};
})();