After display, my texture is fully displayed but not on total surface of window.
even with the following instruction
SDL_RenderCopy(m_sdl_renderer, video_texture, NULL,NULL);
Could you help me to find the problem ?
Thanks a lot
Cyrille Herlem
PS: I use SDL_CreateWindowFrom() to create my window
First of all, you should check if the texture is created properly.
if (!video_texture) {
printf(“Creation of video texture failed: %s\n”, SDL_GetError());
SDL_Quit();
exit(1);
}
Next, in stead of calling
SDL_RenderCopy(m_sdl_renderer, video_texture, NULL,NULL);
With NULL, NULL
You may want to pass in two SDL_Rect rectangles to control more precisely the drawing of the texture.
{
SDL_Rect src_rect = { 0, 0, 440, 445 }
SDL_Rect dst_rect = { 0, 0, 440, 445 }
SDL_RenderCopy(m_sdl_renderer, video_texture, &dst_rect, &src_rect);
SDL_RenderPresent(m_sdl_renderer);
}
Finally, it’s going to be very slow if you create and destroy such a big texture all the time
whilst drawing, so I don’t see why you need the SDL_DestroyTexture there, especially if you are in
a drawing loop.