-
Notifications
You must be signed in to change notification settings - Fork 18
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
Can not use SDL2_gfx primitives for renderering #68
Comments
I have the same problem. The generator does not appear to be including all of the functions in sdl_gfxPrimitives correctly. Trying to use any of the sdl_gfxPrimitive functions results in the error: Has anyone come up with a fix for this yet? |
Actually it appears that that isn't the problem. I believe that the problem lies in the initial bindings generated for SDL_gfx. This package SDL2_gfx_jll claims to have generated the bindings but clearly they are not working for the gfx_primitives functions. They may have to be regenerated and confirmed to work. The good news is that the original PR for adding the bindings into this repo should still work. But the SDL2_gfx_jll package will have to be updated on the registry to make the bindings work. |
Same here for |
I noticed this in the generator.toml: I don't remotely understand how Clang.jl works, but none of the SDL2_gfx functions have prefixes. I wonder if that is the issue? |
Has anyone found a workaround? |
I found a workaround. It's not pretty, but it's better than nothing at the moment. If I get time, I would like to learn more as to actually fix it. Then I dropped it in my artifacts folder with my SDL2.dll file. If you can't find it through searching, you could just update one of the functions in LibSDL2.jl like this to print it out. This file was at:
this returned So once you dropped in your dll, go to all of the sdl_gfx functions, and change them to look like this:
instead of just |
@Kyjor Wow, nice work! I swear I tried basically that exact hack a few weeks ago. I'll attempt your hack when I get some free time. Thanks for finding a fix. Something is better than nothing. :) |
No problem! Like I said, I've only tried it with the framerate functions so far, so your results may vary. I'll probably be trying to work with the actual drawing functions real soon. So if there's any gotchas, I'll let you know |
Alright, so a quick update. I followed through (more carefully this time!) with your steps, and I can corroborate your results with my own. The frame-rate functions work as intended, however, when trying some of the graphics functions (I tried pixelRGBA, hlineRGBA, and circleRGBA), they are not working. On the bright side however, I am no longer getting the original error I was getting months ago which read along the lines of: could not load symbol "some gfxPrimitive function name". So as far as I can tell, the package now has access to the SDL2_gfx functions, but for some reason the graphics primitives are not drawing. Unfortunately, this issue is still way above my current skillset, so if anyone has some further insight into how to get the drawing functions to work, that would be much appreciated. |
@Noremac11800 can you send me a MWE of your code? I can try and mess with it. |
@Noremac11800 Here's an example: 😄 https://gist.github.com/Kyjor/c6d9b82245f83311f10a5e4e8a41ca59 |
Hi @Kyjor, sorry for the late reply I've been a bit busy. A MWE of my code is essentially identical to yours. I used the basic.jl example also. I just tested out your code (making sure to add the necessary I believe the issue lies in the way the sdl_gfx library is communicating with SDL2. Let me explain. Because I am using MacOS and not Windows, when I followed your original fix I had to retrieve the sdl_gfx library from an alternative location. A
I then located the two associated dylibs in my brew Cellar and manually moved them into the .julia/artifacts... directory, containing the LibSDL2.dylib libraries. For reasons that I do not understand, I don't think I was supposed to do that... When I run your minimal example code I get the following output in my terminal:
So I think your fix is working perfectly fine and this issue is close to being resolved. The problem appears to be on my end due to a lack of understanding around dylibs. So I am going to have to toy around with my setup a bit to see if I can get the libraries to look in the right locations for the code. Out of curiosity, I may go and attempt this on my Arch desktop machine instead of my Mac because I may have more luck there. MacOS usually isn't my first choice when it comes to development. I appreciate all of your effort though :) |
AHA! Another update. I just tried out the same process on my Arch machine and it worked flawlessly! So for anyone who wants to know the steps I took:
As far as making a better, more permanent fix, that's a problem for later. But as an immediate hack, this fix works perfectly fine. Nice work @Kyjor! Thanks for all the help. |
No problem @Noremac11800 ! Good luck! |
Minimum working example:
Not only does this not work, it also looks like the SDL2_gfx primitives are not exported. Strangely the SDL2_framerate objects (SDL_initFramerate, SDL_getFramerate, SDL_setFramerate, etc...) which are part of SDL2_gfx do exist!
The text was updated successfully, but these errors were encountered: