Skip to content
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

gg: always use 4 channels in init_sokol_image #16564

Merged
merged 3 commits into from
Dec 1, 2022

Conversation

larpon
Copy link
Contributor

@larpon larpon commented Dec 1, 2022

Fixes vlang/vab#239

Will probably obsolete #16561

At some point init_sokol_image() was changed to use the number of channels detected by stbi instead of the hardcoded 4. While this should've been a good idea, and the most logical thing to do - reality is a little different. sokol_gl expects .rgba8/4 channels in it's default contexts, which gg currently also uses when loading images. This PR set the number of channels back where it came from and leaves a more juicy note for next time :)

I don't think it's a good idea to manipulate the channel number like this in unexpected places:
https://github.com/vlang/v/pull/15981/files#diff-3566edbb636a40b3c608bb8b51fb2403f57929e1626e96f39ccb7256f0573a99R121
The correct channel info is nice to have in other situations - the "problem" is the sokol_gl default contexts which expects 4 channels. So I've removed the ugly workaround in this PR as well

I guess this is a good reason to look at getting v gret visual tests up and running for Android/vab as well...

I've tested the PR against the images provided in #16024 with the image viewer also - they all load and work except for basn3p08.png and basn3p08.gif which also both fail to load in GIMP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An example works weirdly.
2 participants