The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_CreateTextureFromSurface breaks SDL_RenderFillRect
rtrussell


Joined: 10 Feb 2016
Posts: 88
This is very strange. With SDL 2.0.4 and GLES 1 (Android), calling SDL_CreateTextureFromSurface breaks a subsequent SDL_RenderFillRect, despite the two calls being entirely unrelated - except for using the same renderer. To give a specific example, this code works correctly (it fills the render target with blue):

Code:
SDL_SetRenderDrawColor(myRenderer, 0, 0, 255, 255) ;
SDL_RenderFillRect(myRenderer, NULL) ;

But this code doesn't work; the render target is not filled with blue (despite neither mySurface nor myTexture being used anywhere):

Code:
mySurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 8, 8, 32,
            0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF) ;
myTexture = SDL_CreateTextureFromSurface(myRenderer, mySurface) ;

SDL_SetRenderDrawColor(myRenderer, 0, 0, 255, 255) ;
SDL_RenderFillRect(myRenderer, NULL) ;

I presume there must be some leakage of renderer state that is causing the two nominally unrelated calls to interact.

Can anybody suggest where I might look in the code of SDL to try to trace this bug? I've created a self-contained testcase which I can upload if anybody is interested. I have explained in earlier threads why I cannot use GLES 2, so please don't suggest that as a solution.

Richard.
Re: SDL_CreateTextureFromSurface breaks SDL_RenderFillRect
rtrussell


Joined: 10 Feb 2016
Posts: 88
rtrussell wrote:
Can anybody suggest where I might look in the code of SDL to try to trace this bug?

Nobody? I'm happy to delve into the SDL source code but I need a pointer to the kind of thing that might result in this strange interaction. What aspect of 'renderer state' might cause SDL_RenderFillRect not to work?

Or am I looking in completely the wrong place - could it be a bug in GLES rather than SDL? If so, what sort of workaround should I be looking for?

I'm beginning to think I'm the only person using SDL 2 with GLES 1 (albeit with good reason). If anybody is thinking of dropping support for GLES 1 in a future release of SDL, please don't!


Richard.