Menu

#405 OpenGL fullscreen and scaler for SDL UI

future
open
nobody
UI (9) SDL (2)
5
2019-05-09
2018-03-18
No

This patch add OpenGL fullscreen mode and OpenGL HW scaler to SDL1.2 UI.

So we now can do fullscreen without mode change and can resize fuse window to any size.

configure.ac:
- if SDL UI selected -> check OpenGL library available: we can disable OpenGL
- if OpenGL enabled -> enable/disable HW scaler: we can disable hw scaler
- add some printout about OpenGL and hardware scaler

man/fuse.1:
- add description about --opengl-filter-nearest

settings.dat:
- add opengl-filter-nearest setting

ui/scaler/scaler.[ch]:
- add hardware scaler definition

ui/sdl/sdldisplay.[ch]:
- add code to OpenGL scaling, fullscreen and window resize handling. We use a 2D texture to display scaled image. We do it without shaders, so it may work with < OpenGL v2.0 (if hat matters at all :)

ui/sdl/sdlui.c:
- add code to catch SDL_VIDEORESIZE events

1 Attachments

Discussion

  • Sergio Baldoví

    Sergio Baldoví - 2018-03-18

    Thanks, Gergerly. I've tested your patch and works well on my PC.

    I think that a "resizable" scaler name would be more friendly than "hardware" to a non-tech savvy user?

     
    • Gergely Szasz

      Gergely Szasz - 2018-03-18

      Yes, maybe "resizable" is better. I never found a good name for that...

      I attach the patch with scaler renamed to "Resizable".

       

      Last edit: Gergely Szasz 2018-03-18
  • Fredrick Meunier

    I can't test this one as the Mac SDL doesn't have OpenGL (at least the one I have).

    Sergio: do you think this needs any attention before committing?

     
  • Sergio Baldoví

    Sergio Baldoví - 2018-04-15

    I can't test this one as the Mac SDL doesn't have OpenGL (at least the one I have).

    Are you sure that it isn't needed different library/header names? On Windows I need opengl32 (ships with Windows) rather than GL. Check the AX_CHECK_GL macro for inspiration: "On the OSX platform, there’s two possible OpenGL implementation. One is the OpenGL that ships with OSX, the other comes with X11/XQuartz"

    Sergio: do you think this needs any attention before committing?

    As far as I can see:

    • Review coding style and remove trailing spaces.
    • Document "resizable" filter in the manual.
    • On Linux when I change the selected machine the "resizable" filter acts like "normal", ie, not resizable.
    • On Windows I see some artifacts similar to the ones that appeared in the SDL2 UI patch ([patches:#326]), most likely rounding errors.

    It would be good to test this patch with different machines/platorms.

     

    Related

    Patches: #326


    Last edit: Sergio Baldoví 2018-04-15
  • Sergio Baldoví

    Sergio Baldoví - 2018-04-15

    First two points hopefully addressed in branch patches-405-sdl1-opengl-scaler.

     
  • Fredrick Meunier

    I needed to add the following to get GL to be accepted by configure, but still didn't get the Resize filter on the Mac but haven't tried to work out what's going wrong:

    diff --git a/configure.ac b/configure.ac
    index a124cfd0..3c87abfe 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -437,6 +437,11 @@ if test "$UI" = sdl; then
         opengl=yes)
       AC_MSG_RESULT($opengl)
       if test "$opengl" = yes; then
    +    AC_PATH_XTRA
    +    CFLAGS="$CFLAGS $X_CFLAGS";
    +    LDFLAGS="$LDFLAGS $X_LIBS";
    +    LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS";
    +
         AC_CHECK_LIB( GL, glTexImage2D,
           [AC_CHECK_HEADERS([GL/gl.h],
             [AC_DEFINE([SDL_USE_GL], 1, [Defined if we're going to be using OpenGL])
    
     
  • Gergely Szasz

    Gergely Szasz - 2019-05-09

    I update the patch:
    - i included the configure.ac stuff
    - added 'resizable' to bash completion
    - now timex screen works too
    - and when menu is open and we rescale, or move, 'reexpose' the window, the screen is updated.

    Only one strange things i encounered: the status bar icons rendered one pixel narrower and lower (from left and top), but when we open the menu, then showed up the full size icons .

    I upload three patch:
    1. diff from master
    2. diff from branch (patches-405-sdl1-opengl-scaler) merged with master
    3. diff from current branch (patches-405-sdl1-opengl-scaler)

     

Log in to post a comment.