Re: Android screen rotation issue: testdrawchessboard.c sample + alternate software renderer creation method
Michael Davies <[email protected]> Thu, 16 Feb 2017 10:27:55 +1100
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CABMU51mAi0FVrmo-WZFceaztUbto1L-L2pZr3bGiBwLb2Zeapw@mail.gmail.com> |
The plot thickens! I've discovered the testdrawchessboard.c sample is actually broken on Android, at least in my environment (latest SDL2 source from Mercurial, Android 7.0 (SDK 24), Android NDK 13.1). With no modifications to the sample source code, once the screen rotates, the software renderer no longer updates the screen, but it does keep the last image it rendered hanging around. I believe this bug has gone unnoticed because the DrawChessboard() method draws a static image, so it's entirely not obvious when the software renderer breaks and appears as if the sample is working. If you modify this line in DrawChessboard() from: SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF); to SDL_SetRenderDrawColor(renderer, rand()%255, rand()%255, rand()%255, 0xFF); it will turn the chessboard into a disco floor, and it will become obvious when the renderer stops updating the screen. Cheers, Michael On 15 February 2017 at 13:40, Michael Davies <[email protected]> wrote: > Hi all, > > If I build the testdrawchessboard.c sample (the software renderer demo) > for Android and run it on a device, I can rotate the device to change > orientation and the chessboard follows as expected. However, if I change > the method of creating the software renderer (around line 110) from: > > surface = SDL_GetWindowSurface(window); > renderer = SDL_CreateSoftwareRenderer(surface); > > to > > renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_SOFTWARE | > SDL_RENDERER_TARGETTEXTURE ); > > then when I launch the app, rotating the device to change orientation > results in the screen going black until I restart the app. > > Is my alternative method of creating a software renderer invalid, or is > this a bug in SDL2? > > Tested with Mercurial tip code (as of last night) using an HTC One M8 and > Samsung Galaxy Note 4. > > Thanks in advance, > Michael > _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org