You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I've started using cl-sdl2 for a small personal project; for the most part, the experience has been good. Thanks!
However, when I tried to use sdl2:get-texture-color-mod to get the current color mod state of a texture, I got back garbage results; even when I ran a loop, setting the texture color just before printing out the results of ( sdl2:get-texture-color-mod tex ), the values were basically random.
I had a look at the source code, and found this definition-
(defun get-texture-color-mod (texture)
"Use this function to get the additional color value multiplied into render copy operations."
(c-with ((r :unsigned-short)
(g :unsigned-short)
(b :unsigned-short))
(check-rc (sdl-get-texture-color-mod texture (r &) (g &) (b &)))
(values r g b)))
I replicated it in my code, and found that my problem was fixed by changing the types of r, g, and b to :char rather than :unsigned-short; I'm on a 64-bit machine- I'm guessing there's something going on with discrepancies in the sizes of different types?
For now, my problem is fixed (on my machine...), but I thought I ought to let you know.
If you need any more info, just ask.
The text was updated successfully, but these errors were encountered:
Hello, thanks for reporting this. After looking at the SDL2 documentation, I have no idea if things changed or not, or why the previous maintainer used a 2-byte type, when it is marked as Uint8. Would you mind sending that PR over?
Edit: It's been a while since I looked at this code, but that definitely has to be unsigned, which you didn't mention in your fix above. I'm not sure if :char maps to :unsigned-byte, :signed-byte, or what. So that has to be taken into consideration.
Hello. I've started using cl-sdl2 for a small personal project; for the most part, the experience has been good. Thanks!
However, when I tried to use sdl2:get-texture-color-mod to get the current color mod state of a texture, I got back garbage results; even when I ran a loop, setting the texture color just before printing out the results of ( sdl2:get-texture-color-mod tex ), the values were basically random.
I had a look at the source code, and found this definition-
(defun get-texture-color-mod (texture)
"Use this function to get the additional color value multiplied into render copy operations."
(c-with ((r :unsigned-short)
(g :unsigned-short)
(b :unsigned-short))
(check-rc (sdl-get-texture-color-mod texture (r &) (g &) (b &)))
(values r g b)))
I replicated it in my code, and found that my problem was fixed by changing the types of r, g, and b to :char rather than :unsigned-short; I'm on a 64-bit machine- I'm guessing there's something going on with discrepancies in the sizes of different types?
For now, my problem is fixed (on my machine...), but I thought I ought to let you know.
If you need any more info, just ask.
The text was updated successfully, but these errors were encountered: