-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add files? #53
Comments
You might find it helpful to print the working directory of your application, as your shader files will most likely be loaded relative to that directory; this is platform-specific, so without having provided your OS, I can't be of too much further help here. You can also try putting shader files in
I'm not sure I understand this bit. Where did you get this code? Are you following along with a specific tutorial? Glitter is designed as a starting point, and is not opinionated about how you structure your files on disk as long as they are contained within the
Could you describe what you mean by "its weird than normal"? What would be an example of something normal? I'd be happy to correct this deficiency if you have suggestions about how to make this more friendly to beginners. CMake takes code in your source directory and creates a makefile (or IDE configuration) that knows how to build an executable (in the |
Finally got it working. I need to change the file path like this `Shader ourShader("..\Glitter\Sources\3.3.shader.vert", "..\Glitter\Sources\3.3.shader.frag"); The code is from this tutorial, https://learnopengl.com/Getting-started/Shaders What I mean by weird is that when you add file from visual studio, the file would not be where you expected. The file will be added to Build directory instead of the directory where main.cpp resides. This caused lots of weird error like the compiler cannot find the file and file is missing during runtime. To solve this, i had to print working directory and make modification to the path. I believe most people who use this project are from learnopengl.org since this project is referenced from there. If possible, could you make a folder where all related project files(source, library used) resides in the same folder (and subfolder)? Also why the solution includes library projects? Can we remove the library projects from the solution? Apart from this, I had no other major issue with Glitter. |
I was having the same issue. It's not immediately clear that the path is relative to the build folder and not the binary nor the source file. A simpler solution is to use the shaders that end up in the build folder.
|
shader files acting like the data, I think the best practice is placed in other directory, referenced with absolute path, independent of this project. |
I want to add shader files. I copied the shader file to \Glitter\Glitter\Sources directory but during runtime the file cannot be found. I placed the file in \Glitter\Build\Glitter\Debug, yet the file cannot be found.
This is how I assign the file.
Shader ourShader("3.3.shader.vs", "3.3.shader.fs"); // you can name your shader files however you like
Could you explain how the cmake generated solution configure folder/path? AFAIK, its weird than normal which makes this not really suitable for beginners.
The text was updated successfully, but these errors were encountered: