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 2632 - Corrupted output when copying from a Surface to a Texture
Summary: Corrupted output when copying from a Surface to a Texture
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.3
Hardware: x86_64 Mac OS X 10.8
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-07 20:11 UTC by Maury Markowitz
Modified: 2017-08-14 06:12 UTC (History)
1 user (show)

See Also:


Attachments
Problems blitting in SAIS (164.17 KB, image/tiff)
2014-07-07 20:11 UTC, Maury Markowitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maury Markowitz 2014-07-07 20:11:38 UTC
Created attachment 1740 [details]
Problems blitting in SAIS

I am porting an SDL game 1.x to 2.x on the Mac. I have most of the game ported and operating properly, but rendering is not working.

The game used a single 8-bit Surface to render into. It filled a number of malloc'ed uint8 buffers with data from picture files, then blitted them into the Surface, and then Flipped. So I did this:

sdltxtr = SDL_CreateTexture(sdlrend,
                            SDL_PIXELFORMAT_ARGB8888,
                            SDL_TEXTUREACCESS_STREAMING,
                            640, 480);
sdlsurf = SDL_CreateRGBSurface(0, 640, 480, 8, 0,0,0,0);

Then I let the code bit into the Surface as normal, and then do this:

SDL_UpdateTexture(sdltxtr, NULL, sdlsurf->pixels, 640 * sizeof (uint8));
SDL_RenderClear(sdlrend);
SDL_RenderCopy(sdlrend, sdltxtr, NULL, NULL);
SDL_RenderPresent(sdlrend);

This causes bad output - garbage from the background basically. You can't see it in the image, but I can see the actual "sprites" (some of which are the whole screen) in the display rotating like an analog TV with bad vertical hold. Code is PD, so I'm happy to upload.
Comment 1 Sam Lantinga 2014-07-08 04:14:37 UTC
Did you verify that there are no SDL errors along the way? Can you attach a link to a complete example showing the problem?

Thanks!
Comment 2 Sam Lantinga 2017-08-14 06:12:02 UTC
No response, hopefully this is fixed.