Detach the GL context state to a separate module.

This commit is contained in:
2023-02-09 09:50:44 +08:00
parent 4cd5ebb936
commit c494156983
8 changed files with 118 additions and 7 deletions
+5 -3
View File
@@ -4,23 +4,25 @@
<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { WebGLCanvas, EventEmitter } from "@ray-lab/renderer-webgl";
import { WebGLRenderer } from "@ray-lab/renderer-webgl";
const contentRef = ref<HTMLDivElement>();
const canvasEle = document.createElement("canvas");
onMounted(() => {
const c = new WebGLCanvas({
const renderer = new WebGLRenderer({
canvas: canvasEle,
container: contentRef.value,
autoResize: true,
width: 800,
height: 600
});
// c.on("resize", () => { console.log(c.canvas.width, c.canvas.height) });
if (contentRef.value) {
contentRef.value.appendChild(canvasEle);
}
console.log(renderer);
})
</script>