cyrilcode / embed-resource Goto Github PK
View Code? Open in Web Editor NEWEmbed binary or resource files (eg textures or GLSL shader files) in CPP using C++11.
Embed binary or resource files (eg textures or GLSL shader files) in CPP using C++11.
Hi
Would using cpp17 std filesystem remove the dep with boost ?
Hi. Thanks for creating this great tool!
I'm facing some trouble when using it. I loaded two .glsl
files but there are always a duplicated }
at the end of the loaded data. I tested to delete the one }
in my shader file, but the problem persists. I then changed the }
in my file to some other characters, there were always a copy of that character.
The output:
#version 330 core
out vec4 fragColor;
void main() {
fragColor = vec4(0.5, 0.1, 0.8, 1.0);
}}
My loading code:
include_directories(ext/embed-resource)
add_subdirectory(ext/embed-resource)
embed_resources(MyResources resources/shaders/test_vs.glsl resources/shaders/test_fs.glsl)
add_executable(target src/MyUtils.cpp src/proj1.cpp ${MyResources})
////////////////////////////////////////
Resource test_vs = LOAD_RESOURCE(test_vs_glsl);
Resource test_fs = LOAD_RESOURCE(test_fs_glsl);
I don't see any related issue on this, so may be I'm loading the resource incorrectly? Could you check if this is a bug? Thanks!
Thanks for the tool.
The tool did not work immediately, so I opened a thread in the german language C++ Community.
Among other things I noticed the same as described in Load .glsl with extra character at the end of the string?
kind regards
I've been ripping my hair out trying to figure this one out, but for some reason this doesn't work when the resources are loaded from within a namespace in C++ (LOAD_RESOURCE
calls), resulting in undefined symbols.
From what I can tell, it's trying to load the resources with the current namespace appended (MyNamespace::_resource_MyResources
), which naturally fails.
I went a step further and tried to convert the logic/code from C to C++, so each resource would actually already exist in the same namespace, but that resulted in the same undefined symbols.
Just to reiterate: if I use the same exact code in the global/anonymous namespace (eg. without a namespace), everything just works, but when called from within any kind of namespace, it all breaks down and I have no idea.
I'm really, really hoping someone could shed some light on this and hopefully provide a solution/workaround. I'll see about opening a StackOverflow question regarding this as well, as this might just be a quirk with CMake etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.