0
\$\begingroup\$

Code:

SDL_Surface* tmpSurface = IMG_Load("Assets/Player.png");
playerTex = SDL_CreateTextureFromSurface(renderer, tmpSurface);
SDL_FreeSurface(tmpSurface);

Rendering the Texture:

SDL_RenderCopy(renderer, playerTex, NULL, NULL);

I did check to see if any of them returned null and playerTex is still null even though it is being set to a texture, im not sure why can anyone help

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What does SDL_GetError() say? \$\endgroup\$
    – user35344
    Sep 14, 2020 at 9:03

1 Answer 1

0
\$\begingroup\$

I fixed this: I was creating a new renderer when I was initializing the texture instead of reusing the public one.

Using SDL_GetError helped me figure this out.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You might want to consider marking this as the accepted answer if it solves the issue. \$\endgroup\$
    – Vaillancourt
    Oct 14, 2020 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .