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> <!DOCTYPE html>
<html> <html>
<head> <head>
<script type="module" src="panorama-viewer.js"></script> <script 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>
</head> </head>
<body> <body>
<h1>Panorama Viewer</h1> <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) => { const render = (canvas) => {
let gl = canvas.getContext("webgl"); let gl = canvas.getContext("webgl2");
const vShaderSrc = ` const vShaderSrc = `
attribute vec3 position; attribute vec3 position;
@ -53,4 +59,5 @@ export const render = (canvas) => {
gl.enableVertexAttribArray(positionLocation); gl.enableVertexAttribArray(positionLocation);
gl.vertexAttribPointer(positionLocation, 3, gl.FLOAT, false, 4*3, 0); gl.vertexAttribPointer(positionLocation, 3, gl.FLOAT, false, 4*3, 0);
gl.drawArrays(gl.TRIANGLES, 0, 3); gl.drawArrays(gl.TRIANGLES, 0, 3);
} };
})();