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
Currently, I'm trying to create a Gameboy Advance Emulator. For graphics, I have chosen to go with SDL2 and have decided to use SDL.zig as an alternative to using direct C bindings. Thank you for your work in creating this library.
I have stumbled across some confusing behaviour and have created a rather trivial example, which I shall link here.
The program creates and renders a white texture in the BGR555 Pixel Format. If you are to run this program, you will find a variable amount of garbage data displayed on the texture like in the screenshot below:
If you comment out L37, L38, and L39, and replace &white_heap with &white on L49 (the SDL_UpdateTexture call) the program works as expected, producing:
It is my current understanding that where the bitmap was allocated should have no effect on SDL2 displaying the texture itself.
I am quite unfamiliar with SDL.zig and SDL as a whole and therefore do not really know where to get started. I understand that you prefer contributions rather than bug reports and if so, I would at the very least appreciate some assistance regarding how I should go about identifying and resolving this issue.
The text was updated successfully, but these errors were encountered:
&white_heap is the address of the pointer, not the content of the pointer. Just pass white_heap instead. Right now, you're luckily just indexing into white with an offset. The "garbage" you see there is actually the address of your white_heap memory 😁
Currently, I'm trying to create a Gameboy Advance Emulator. For graphics, I have chosen to go with SDL2 and have decided to use SDL.zig as an alternative to using direct C bindings. Thank you for your work in creating this library.
I have stumbled across some confusing behaviour and have created a rather trivial example, which I shall link here.
The program creates and renders a white texture in the
BGR555
Pixel Format. If you are to run this program, you will find a variable amount of garbage data displayed on the texture like in the screenshot below:If you comment out L37, L38, and L39, and replace
&white_heap
with&white
on L49 (theSDL_UpdateTexture
call) the program works as expected, producing:It is my current understanding that where the bitmap was allocated should have no effect on SDL2 displaying the texture itself.
I am quite unfamiliar with
SDL.zig
andSDL
as a whole and therefore do not really know where to get started. I understand that you prefer contributions rather than bug reports and if so, I would at the very least appreciate some assistance regarding how I should go about identifying and resolving this issue.The text was updated successfully, but these errors were encountered: