I’m trying to use SDL_LockTexture and SDL_UnlockTexture for direct access to pixels in SDL 2.0. When I try to set pixels, I never see anything happen. Here’s my code:
Code:
void *pixels;
int pitch;
SDL_LockTexture(mytexture, NULL, &pixels, &pitch);
// Set pixel 100,100 to blue
((uint32_t *)pixels)[100 * 100] = 255;
SDL_UnlockTexture(mytexture);
It doesn’t make the pixel blue. Can anyone help?