A surface exists. How to display it? |
Alex
|
You can copy image from your texture to window with SDL_RenderCopy function.
For example:
Window is default rendering target, if you do not changed this target with SDL_SetRenderTarget. |
|||||||||||||
|
A surface exists. How to display it? |
Brian Puthuff
Guest
|
I don't see where you are copying the texture to the renderer in your code.Use SDL_RenderCopy() to draw the texture to the rendering context.
To do that you need a SDL_Rect to define the size and position of the texture you are trying to render For example: ... // create display rectangle SDL_Rect text_rect; int text_w, text_h; // for getting texture width and height SDL_Texture *tex1 = NULL;tex1 = SDL_CreateTextureFromSurface(ren1,textSurface); // grab width and height SDL_QueryTexture(tex1, NULL, NULL, &text_w, &text_h); // define texture display rect text_rect.x = 0; // or whatever x coordinate you want text_rect.y = 0; // or whatever y coordinate you want text_rect.h = text_h; text_rect.w = text_w; SDL_UpdateWindowSurface(win1);SDL_Delay(5000); // actually render texture to renderer SDL_RenderCopy(ren1, tex1, NULL, &text_rect);SDL_RenderPresent(ren1); SDL_Delay(5000); ... On Wed, Apr 15, 2015 at 6:25 AM, bilsch01 wrote:
|
|||||||||||||
|
bilsch01
|
Thank you |
|||||||||||||||
|