CSFML
CSFML copied to clipboard
[Question] Loading sRGB textures
I cannot figure out how to load an sRGB texture from disk (or memory, or image) in CSFML. In SFML, if I understand it correctly, you would do:
sf::Texture texture;
texture.setSrgb(true);
texture.loadFromFile(...);
But in CSFML this is not possible since the loadFrom
functions are not exposed directly. Is it currently possible at all to load an sRGB texture? Am I missing something?
IIRC:
sfTexture *texture;
sfTexture_loadFromFile(texture, "filepath");
Indeed. This looks like a missing feature in CSFML.
So would that work along the lines of:
sfTexture *texture = sfTexture_createEmpty(); // <- this function needs to be created
sfTexture_setSrgb(texture, true);
sfTexture_loadFromFile(texture, file); // <- this function needs to be created
// ...
sfTexture_destroy(texture);
?
I can implement this if this design is agreed upon.
Or an extra srgb
argument to all the create functions. I should make a quick review of the sfTexture API to figure out what's best.
I think the version with create + setSrgb + load, while more verbose, is basically the same as the SFML way of doing that, thus it's what I would expect I'd have to do in CSFML also.
If CSFML wants to be just a binding API for SFML I think the functions should behave the same way, and since there is no "srgb" extra argument in SFML, IMHO there shouldn't be one in CSFML either
(unless of course that extra argument is also added to the sf::Texture
constructor).
Any updates?
No updates. Kind of forgot about this issue and Laurent hasn't followed up on it either.
@therealbluepandabear This has been addressed now, just awaiting the review process to finish on #177 and then it will be in master. That doesn't mean you'll have access to it straight away in D since I assume the binding is pinned to 2.5.1. I believe (and @eXpl0it3r can confirm this for us) that there is a plan to do a 2.5.2 release for CSFML prior to 2.6.0.
This should be fixed with #177