[SDL2] Texture vs Surface ?
Posted: Sun Jan 26, 2014 5:37 am
Hello everybody,
First question is: What is the difference between Texture and Surface in SDL v2 ?
Second question: Why the texture rendering is stretched ?
Thank you in advance.
First question is: What is the difference between Texture and Surface in SDL v2 ?
Second question: Why the texture rendering is stretched ?
bool CTexture::OnDraw(SDL_Renderer* Renderer, SDL_Texture* Texture, int XDest, int YDest)
{
if(Renderer == NULL || Texture == NULL)
{
cerr << "Can't render texture [SDL_Error: " << SDL_GetError() << "]" << endl;
return false;
}
SDL_Rect DRect;
DRect.x = XDest;
DRect.y = YDest;
// This function stretchs the texture ????!!!
SDL_RenderCopy(Renderer, Texture, NULL, &DRect);
return true;
}
PS: Please, explain me when do we use Surface and when do we use Texture in SDL v2.Thank you in advance.