Change TEXTURE_ACCESS from TARGET to STREAMING

"stewambo" <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
Hey,
I need to change the TEXTURE_ACCESS of some textures from TARGET to STREAMING, because i want to access and change individual pixels. My best guess was to use SDL_RenderReadPixels of my TARGET-texture and write the pixel data into a new STREAMING-texture, but the resulting STREAMING-texture is flipped upside-down and i don't really know why that happens (maybe because open_gl has it's origin in the bottom-left and not top-left?) and how to fix it...
My code looks like this:

Code:

SDL_Texture* targetTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, width, height);
SDL_SetRenderTarget(renderer, targetTexture);
//render some things onto targetTexture
SDL_Texture* streamingTexture = SDL_CreateTexture( renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, width, height );
void* streamingPixels;
int streamingPitch;
SDL_LockTexture( streamingTexture, NULL, &streamingPixels, &streamingPitch );
SDL_RenderReadPixels(renderer, NULL, SDL_PIXELFORMAT_RGBA8888, streamingPixels, streamingPitch);
SDL_UnlockTexture( streamingTexture );
SDL_SetRenderTarget(renderer, NULL);




Any help is appreciated :)

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.