✅ How to read from glsl (shader) file
Hi. I am learning OpenTK and trying to make my own game. Im following learnopentk and i am stuck with reading shader files. I have the shader.vert and shader.frag files in my solution explorer, but for some reason, it tries to get the file from some other path. I tried typing in the exact path for where the file is on my computer and that worked, but it wont work on other devices, so i don't know what to do in this case. Any help is appreciated
11 Replies
thats not really an glsl/shader issue, its basically about the current working directory and u giving a relative path
imagine a simple console app
example.exe
that tries to read "default.frag"
in terminal i can do
and the application would look for the file C:\some\path\default.frag
,
if i would do
the application would look for the file D:\hello\whats\going\on\default.frag
Just because the files exists in solution doesn't mean they are automatically copied.
And they won't be embedded.
right click on file in solution -> copy to output folder always
in ur case the current working directory would be that
<project-root>\bin\x64\Debug\net8.0\
path.
and... is it there? did u check in explorer?The library loads them from disk, not embedded (Resources)
the mentioned stuff wouldnt embedd it as resource nor would it try to read it from there
No the files are in the project folder. I just need to find out how I can make the program look through the project folder and not the other path
can u right click the frag and vert shader files, click on properties and check if its actually set to copy to output dir?
I'll check
Yh it was off
It worked. Thanks
glad we could help o7
if ur questen is answered please mark this thread by $close ing it
ohh right, modix is acting up ...
use the
/close
command to mark the thread as answeredalright