I got stuck in some kind of "logical" routine. My code receives live preview pictures from my camera, which are converted to RWops struct and finally be loaded as texture to SDL. Now my question is: How can i update the texture without destroying and rebuilding it? Some code im using atm:
for(x=0; x<100; x++){
capture_to_memory(camera, context, (const char**)&data, &size);
rw = SDL_RWFromConstMem(data, size);
// This part is building the texture through SDL_image
sdlTexture = IMG_LoadTexture_RW(sdlRenderer, rw, 0);
SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
SDL_RenderPresent(sdlRenderer);
SDL_DestroyTexture(sdlTexture);
}
As u see, and how i guess, thats totally inefficient. What i notice is that for the 100 pictures it takes me round 12 seconds to display them (jpg). If i just let the capture and conversion run, its done in 4.5 sec. So it seams my routine with building and destroying the texture is slowing all down.
Any suggestions maybe?