Skip to content

Commit

Permalink
fix issue with fetch path
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan0 committed Oct 10, 2024
1 parent c75222b commit 485ca4a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {initShaderProgram} from "./shader-util.ts";

import {mat4} from 'gl-matrix';

const env = import.meta.env



Expand Down Expand Up @@ -70,8 +71,8 @@ function main() {
gl.depthFunc(gl.LEQUAL) //Near objects obscure distant ones


const vertShaderPromise = fetch('/shaders/shader.vert').then(file => file.text());
const fragShaderPromise = fetch('/shaders/shader.frag').then(file => file.text());
const vertShaderPromise = fetch(env.BASE_URL + 'shaders/shader.vert').then(file => file.text());
const fragShaderPromise = fetch(env.BASE_URL + 'shaders/shader.frag').then(file => file.text());
Promise.all([vertShaderPromise, fragShaderPromise]).then(shaderStrings => {
const shaderProgram = initShaderProgram(gl, shaderStrings[0], shaderStrings[1]);
if (!shaderProgram) {
Expand Down

0 comments on commit 485ca4a

Please sign in to comment.