I have an initialized renderer in SDL2 that works fine. I create some textures from images using SDL_CreateTextureFromSurface and store them in a vector.

Afterwards, I create an empty texture so as to render to it a background texture and some text: SDL_Texture * container = SDL_CreateTexture(Renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,size.first,size.second); The problem is that the returned memory address in container is the address of the first texture that was created with renderer as shown in the image below. Textures is a vector< SDL_Texture * > , container is the pointer above.

The textures field is a field in the renderer thatI presume is set to the address of the last texture created. Before running the command above, it pointed to the last texture created (0x222b70)

debugger information

After the call, the texture in the vector is of course overwritten, which is a problem. There are no errors from SDL_GetError().

What's going on?

  • 1
    \$\begingroup\$ Could you post some code that you're using that makes the problem appear? This seems quite odd to me as this hasn't ever happened in my programs, so seeing your code might reveal something. Just make sure to leave all irrelevant bits out when posting the code. \$\endgroup\$ – Tyyppi_77 Oct 30 '15 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.