hello, i need help understanding/rewriting c code to odin (following this tutorial on sdl3: https://solhsa.com/gp2/ch02.html)
int* gFrameBuffer
char* pix;
int pitch;
SDL_LockTexture(gSDLTexture, NULL, (void**)&pix, &pitch);
for (int i = 0, sp = 0, dp = 0; i < WINDOW_HEIGHT; i++, dp += WINDOW_WIDTH, sp += pitch)
memcpy(pix + sp, gFrameBuffer + dp, WINDOW_WIDTH * 4);
from what i understand framebuffer and pix are arrays? and in memcpy(pix + sp is sp offset from the pointer?
in odin, i'm trying to do this:
gframe_buffer: ^int
pix: rawptr
pitch: i32
sdl.LockTexture(&texture, nil, &pix, &pitch)
sp := 0
dp := 0
for i := 0; i < window_height; i += 1 {
sp += pitch
dp += window_width
mem.copy(pix + sp, gframe_buffer + dp, window_width * 4)
}
but i get error Mismatched types in binary expression 'pix + sp' : 'rawptr' vs 'int'
i tried looking for stuff on how i could do this on the odin docs but couldn't find any
thanks!