when you create a new opengl project in visual studio 2008, you get three folders: one for header files, one for source files and one for resource files.
Is it feasible to put a jpg picture in resource files and then link to it to load it as a texture? i want to load jpg pictures as textures, but i want to do that through resource files so that the debug exe contains those files.
how can i link to the pictures that i put in resource files?
I believe If you link the texture as a resource, it will be stored inside your .exe
file. That's not a commonly used solution - usually you'd want to store resources in a separate folder (or an archive/VFS file) next to your .exe
- then the texture will be loaded from this file after you run your program. This also means that you won't have to recompile the big .exe file whenever you replace or modify a texture. So my answer to your first question is - no, it's not really feasible, unless you need to have the whole application with resources in a single .exe
.
If you like the latter option with files (which I recommend), then the easiest way to use the texture from file is to use a loader library like SOIL which simplifies OpenGL texture loading from any format to a single line of code.