We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3648 - SDL_UpdateTexture from a surface has different content than the creation from the same surface
Summary: SDL_UpdateTexture from a surface has different content than the creation fro...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.5
Hardware: x86_64 Windows 8
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-12 15:55 UTC by axel mattauch
Modified: 2017-06-29 12:40 UTC (History)
0 users

See Also:


Attachments
Very small test program (#100 lines) (5.13 KB, text/x-csrc)
2017-05-12 15:55 UTC, axel mattauch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description axel mattauch 2017-05-12 15:55:58 UTC
Created attachment 2732 [details]
Very small test program (#100 lines)

Hello!

I have created a surface through 
  psurface =  SDL_CreateRGBSurfaceWithFormat
and filled the psurface surface with some color (SDL_FillRect)
Then I created a texture from this surface
  ptexture = SDL_CreateTextureFromSurface(prenderer, psurface)
The rendering (SDL_RenderCopy + SDL_RenderPresent) is OK: the screen displays effectively a surface of the color as defined by the SDL_FillRect.

But in a second step, following immediately, I updated the same texture from the same surface by:
  SDL_UpdateTexture(ptexture, NULL, psurface->pixels, psurface->pitch)
While no execution errors are occuring, the display after rendering (SDL_RenderCopy + SDL_RenderPresent)  has a wrong color.

As I simplified atmost the test sequence, I believe that the problem comes from the SDL_UpdateTexture call. 

Thanks for the help.

Axel Mattauch
Comment 1 axel mattauch 2017-06-23 14:20:30 UTC
This bug is in close relation with #3680.
This 3648 shows only that a texture created by SDL_CreateTextureFromSurface from a give surface is modified by  SDL_UpdateTexture, even if the given surface is not changed.
#3680 shows precisely the problem (and the RGBA --> ARGB tournaround)
Comment 2 axel mattauch 2017-06-29 12:40:22 UTC
(In reply to axel mattauch from comment #1)
> This bug is in close relation with #3680.
> This 3648 shows only that a texture created by SDL_CreateTextureFromSurface
> from a give surface is modified by  SDL_UpdateTexture, even if the given
> surface is not changed.
> #3680 shows precisely the problem (and the RGBA --> ARGB tournaround)

Thus, this topic is closed. (see #3680)