Closed bhomaidan1990 closed 4 years ago
@bhomaidan1990 due to VSCode file loading policy restriction you can load texture with relative path or over http with enabled CORS:
"glsl-canvas.textures": {
"0": "./texture.png",
"1": "https://rawgit.com/actarian/plausible-brdf-shader/master/textures/noise/cloud-1.png",
"2": "https://rawgit.com/actarian/plausible-brdf-shader/master/textures/noise/cloud-2.jpg",
}
You can also load textures directly in fragment with relative or remote http path:
uniform sampler2D u_tex0; // data/moon.jpg
uniform vec2 u_tex0Resolution;
uniform sampler2D u_logo; // https://rawgit.com/actarian/glsl-canvas/master/docs/data/logo.jpg
uniform vec2 u_logoResolution;
@actarian Loading the textures directly in fragment works for me with a remote http path, but doesn't with a relative path. I've tried out several options and different vscode workspace hierarchies but no success. Do you have any ideas?
@Chilus texture path should be relative to workspace root folder, eg. if you got a folder named data
in your workspace you should write relative path like this:
uniform sampler2D u_tex0; // ./data/moon.jpg
Interesting. It works with root/.frag and ./data/logo.jpg, but NOT with root/shaders/.frag and ../data/log.jpg.
@actarian Thanks for your detailed explanation.
I added this line to the settings to show the image :
so the error popped up on VsCode, can you please tell me how to render the image correctly?