Open paramita opened 2 months ago
I haven't used our raylib bindings yet, but I imagine you could compile raylib with the configurations you want set to enabled and use the resulting library object instead of the one shipped with Odin. That might be a good workaround for now.
I also needed JPG support. I simply recompiled Raylib with -DCUSTOMIZE_BUILD=ON, -DSUPPORT_FILEFORMAT_JPG=ON and -Draylib_USE_STATIC_LIBS=ON to enable it, then I copied the resulting libraylib.a into the appropriate Odin directory, and recompiled Odin as well.
I don't think we should really deviate from the default Raylib build, like others said you can recompile with support and switch out the library.
An idea might be to better document (or provide scripts for) this process of recompilation.
You could also petition Raylib upstream to have JPG included by default. I don't believe there's any patent encumbrance in JPG since the patent on arithmetic coding expired. And even while that patent was still alive, most JPG implementations (including Photoshop) went with Huffman coding instead of arithmetic coding because of that patent, so there was no reason to exclude JPG support that I can see.
@paramita I just faced the same issue with SVG, it's very annoying from a user point of view. You're like, oh cool, I can just call LoadImageSvg() and you do it and it explode at you because in reality it's not there by default and you don't have any explanation of what to do to enable it.
@Vonixxx Could you explain quickly how to recompile Raylib? I don't see much stuff in Odin/vendor/raylib
. I don't have a strong background on compilation and so on.
@Vonixxx Could you explain quickly how to recompile Raylib? I don't see much stuff in
Odin/vendor/raylib
. I don't have a strong background on compilation and so on.
I see you're on Windows, so I cannot assist with that. I use Linux.
You have to visit Raylib's own Github page for that anyhow, here's a link explaining how to build for Windows.
@Vonixxx Could you explain quickly how to recompile Raylib? I don't see much stuff in
Odin/vendor/raylib
. I don't have a strong background on compilation and so on.I see you're on Windows, so I cannot assist with that. I use Linux.
You have to visit Raylib's own Github page for that anyhow, here's a link explaining how to build for Windows.
I'm on MacOS. Thanks, I'll look into that for MacOS.
Mhh I'm a bit lost, where is raylib even installed when we install Odin? How can we find that per OS?
It's in the vendor
folder inside the Odin repository
I was asking for the code but I noticed that it does not install the code itself šš»
@paramita I don't know if you succeeded to compile it with JPG enabled but if not, here is how I did it on MacOS on Apple Silicon architecture (idk the Windows equivalent):
brew install cmake
git clone git@github.com:raysan5/raylib.git
cd raylib
CMakeLists.txt
add_compile_definitions(SUPPORT_FILEFORMAT_JPG)
just below the line include(CMakeOptions.txt)
mkdir build
cd build
cmake ..
make
raylib/build/raylib/libraylib.a
to Odin/vendor/raylib/macos-arm64
It seems that raylib only supports PNG/GIF/QOI/DDS by default: https://github.com/raysan5/raylib/blob/master/src/config.h#L162 It was recently discussed at https://discord.com/channels/568138951836172421/568871298428698645/1263162072557162496
I started to learn odin and wanted to build the image viewer app, so I immediately faced that issue. I hope it's possible to widen the supported image formats. For example, enabling SVG support would be beneficial for building UI elements since the vector image can be scaled to any size.
The following warning is shown when loading jpg as
Image
orTexture2D
:Operating System & Odin Version: