Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use the sdl2 surface pitch when generating an OpenGL image
This should fix #51
I ended up seeing the same issue, and it turned out that the SDL surface pitch generated from sdl2-ttf was not being taken into account when sending the pixel data to OpenGL. Essentially there are sometimes gaps in the data because the sdl2 surface gets aligned to a power-of-two row length, instead of the number of bytes in each row.
I tested locally and it fixed the issue.
If the pitch ends up being the same as the width of the surface in pixels, this should still work fine.
2nd commit:
This should fix #32
Fix handling of different byte orders on SDL_Surface when converting to GL texture
SDL_ttf is generating argb32 images, while loaded images are rgba to start with.
With this change, we'll now convert the SDL surface to rgba32 if it's not that
format already.
Note that previously text was working with :bgra, which is :argb in big-endian
format. That's why I went with rgba32 vs rgba8888, which would have the wrong
endianness. I tested all of this out to come to that conclustion.
Tested this change and both text and images are loading with the proper colors
now.
3rd commit:
Removed unused 'typeface' binding
Convert empty text lines to a single space since sdl2-ttf throws an error on an
empty string. Converted to space instead of removing to keep line height
formatting. This was causing issues with type errors from SBCL that ended up
having empty lines on them. The error wouldn't display.