in reply to Re^3: SDL/SDLx issue with application resizing
in thread SDL/SDLx issue with application resizing

Hello Lotus1,

Thanks for having tried, I appreciate :)

The error message above suggest an issue with DirectDraw (DDraw), maybe something related with the driver. I'll look at this, but first queries on Google do not return much answers. Stay tuned.

  • Comment on Re^4: SDL/SDLx issue with application resizing

Replies are listed 'Best First'.
Re^5: SDL/SDLx issue with application resizing
by Lotus1 (Vicar) on Feb 01, 2019 at 14:50 UTC

    Hi Garden Dwarf,

    On my home computer I was able to run your application and I also sometimes received the same error message with the crash. Sometimes it crashes without an error but I also had a few cases where it successfully resized. I found a comment somewhere that said on Windows platforms you need to reinitialize some things after the resize. The fact that I could resize a few times makes me think it isn't a driver issue but some kind of memory allocation or math error due to resizing.

    I created a simpler program to demonstrate this error by adding the resizeable option to one of the examples that come with the SDL module. I'm planning to try it tonight on Linux to see what happens.

    This isn't my tested version but should be close.

    #modified version of SDL-2.548/examples/SDLx/app.pl use SDL::Event; use SDLx::App; my $app = SDLx::App->new( title => "Lines", width => 640, height => 480, resizeable >'on', ); sub draw_lines { $app->draw_line( [ 0, 0 ], [ rand( $app->w ), rand( $ +app->h ) ], 0xFFFFFFFF ); $app->update(); } sub event_handle { my $event = shift; my $app = shift; $app->stop if ( $event->type == SDL_QUIT ); if($event->type==SDL_VIDEORESIZE){ $app->resize($event->resize_w,$event->resize_h); } } $app->add_event_handler( \&event_handle ); $app->add_show_handler( \&draw_lines ); $app->run();

      I made my code independent of the video buffer. All is computed in "Virtual" buffers at a fixed width/height and then scaled to fit the screen (Rotozoom module). So I don't see any issue with maths.

      In the meantime, I was able to observe the same behavior as you reported (time to time resizing works, time to time resizing crashes with a message, and time to time resizing crashes without any error message). It is then quite difficult to investigate, as the result may vary between tries.

      I really hope you will find something with your tests. And even if you don't, thanks again for your time ;)

      Update

      I've tried the opengl example from the Examples folder of the SDL installation (reason: it seems to uses opengl instead of DirectX) and allowed the window to be resized. Result: I can change the size without any issue (note that the image is not resized along with the window, but I don't think it does matter, doesn't it?).

        I didn't explain my statements above very well, it was kind of stream of consciousness. The test code I made was to rule out something in your application. The simple example has the same issues as your program. The error message seems to be coming from SDL::Video::set_video_mode. SDLx::App::resize has the call shown below that should print an error. Since we never see this error the problem is somewhere in this function.

        $self = SDL::Video::set_video_mode( $w, $h, $bpp, $flags ) or die "SDL cannot set video:" . SDL::get_error;

        The functions in SDL::Video are in a dll so this is as far as I got.