aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl
AgeCommit message (Collapse)Author
2018-07-08GUI: Add Stretch Mode selection in Options dialogThierry Crozat
2018-07-08SDL: Implement stretch mode APIThierry Crozat
Four modes are supported: - Use original size with no scaling - Scale by an integral amount as much as possible but not bigger than the window. - Scale to fit the window while respecting the aspect ratio. There may be black bars on the left and right, or on the top and bottom, but not both. This is the default, and the old behaviour. - Scale and stretch to fit the window. In this mode the aspecy ratio is not respected and there is no black bars. The mode is controled by the "scaling_mode" value (between 0 and 3) in the config file. Also add Crtl-Alt-s hotkey to cycle through scaling modes
2017-12-10SDL: Enable the startup fullscreen hack for X11 onlyBastien Bouclet
It causes problems on AmigaOS and Linux/SDL2/Vivante
2017-10-15BACKENDS: Refactor OpenGL & SDL graphics backendsColin Snover
This patch refactors the OpenGL and SDL graphics backends, primarily to unify window scaling and mouse handling, and to fix coordinate mapping between the ScummVM window and the virtual game screen when they have different aspect ratios. Unified code for these two backends has been moved to a new header-only WindowedGraphicsManager class, so named because it contains code for managing graphics managers that interact with a windowing system and render virtual screens within a larger physical content window. The biggest behavioral change here is with the coordinate system mapping: Previously, mouse offsets were converted by mapping the whole space within the window as input to the virtual game screen without maintaining aspect ratio. This was done to prevent 'stickiness' when the mouse cursor was within the window but outside of the virtual game screen, but it caused noticeable distortion of mouse movement speed on the axis with blank space. Instead of introducing mouse speed distortion to prevent stickiness, this patch changes coordinate transformation to show the system cursor when the mouse moves outside of the virtual game screen when mouse grab is off, or by holding the mouse inside the virtual game screen (instead of the entire window) when mouse grab is on. This patch also improves some other properties of the GraphicsManager/PaletteManager interfaces: * Nullipotent operations (getWidth, getHeight, etc.) of the PaletteManager/GraphicsManager interfaces are now const * Methods marked `virtual` but not inherited by any subclass have been de-virtualized * Extra unnecessary calculations of hardware height in SurfaceSdlGraphicsManager have been removed * Methods have been renamed where appropriate for clarity (setWindowSize -> handleResize, etc.) * C++11 support improved with `override` specifier added on overridden virtual methods in subclasses (primarily to avoid myself accidentally creating new methods in the subclasses by changing types/names during refactoring) Additional refactoring can and should be done at some point to continue to deduplicate code between the OpenGL and SDL backends. Since the primary goal here was to improve the coordinate mapping, full refactoring of these backends was not completed here.
2017-10-15BACKENDS: Fix some comment typosColin Snover
2017-10-07BACKENDS: Fix window sizing of games that switch between multiple resolutionsColin Snover
2017-10-07SDL: Do not reset window size when engines update rendering surfaceColin Snover
This change allows: * Engines to update their target rendering surface/size and pixel format with the backend multiple times during gameplay; * Users to resize the ScummVM window without having it reset size/position every time an engine updates its target surface format; * Conversions/scaling to continue to run efficiently in hardware, instead of requiring engines to pick their maximum possible output format once and upscale inefficiently in software; * The window to reset size once when an engine calls to set its initial output size, and to reset again once ScummVM returns to the launcher. This is relevant for at least SCI32 and DreamWeb engines, which perform graphics mode switches during games.
2017-07-06SDL: Only recreate SDL2 window when necessaryColin Snover
Destroying and recreating the SDL window whenever the video mode changes in SDL2 is not necessary and causes several problems: 1. In windowed mode, the game window shifts position; 2. In fullscreen mode in macOS, every time the window is recreated, it causes the OS to play its switch-to-fullscreen animation again and emit system alert noises; 3. The window content flickers; and 4. The engine loses events from the old destroyed window. This patch changes the SDL backend code to avoid destroying and recreating the SDL window when using SDL2, except when switching OpenGL modes, since there is no way to change the OpenGL feature of a window. There are still some outstanding issues with OpenGL where window size ends up getting reset even though the user has resized it; this will probably need to be addressed at some point in another patch. Thanks to @bgK and @criezy for their feedback which made this patch much better. Co-Authored-By: Bastien Bouclet <bastien.bouclet@gmail.com>
2017-05-21BACKENDS: Compress screenshots using PNG if availableColin Snover
Closes gh-948.
2017-04-24SDL: Improve debug and warning messages when saving screenshotsThierry Crozat
In particular this adds a warning when failing to save a screenshot in OpenGL mode (there was already one in SurfaceSDL mode).
2017-04-24SDL: Use dynamic cast instead of C cast to get screenshot pathThierry Crozat
2017-04-24WINDOWS: Change location where screenshot are savedPala
This fixes bug #9701: WINDOWS: Flow of taking screenshots on Windows is broken
2016-11-20OPENGLSDL: Fix signed/unsigned comparisonColin Snover
2016-10-18SDL: Fix typo in function nameOri Avtalion
2016-10-13OPENGLSDL: Add hotkey to enable/disable filteringThierry Crozat
Crtl-Alt-f now enables/disables filtering instead of changing the graphics mode. Since there is only one graphics mode now, a hotkey to change it is a bit useless.
2016-10-13OPENGLSDL: Make some OSD messages translatableThierry Crozat
Also change some OSD messages to be the same or similar to messages used by the Surface SDL code.
2016-09-18SDL: Ignore outdated SDL resize event in OpenGL modeThierry Crozat
Those outdated resize events are sent from SDL_DestroyWindow when the window is fullscreen and doesn't have the SDL_WINDOW_FULLSCREEN_DESKTOP flag (thus Surface SDL is not affected). Switching resolutions in fullscreen, or switching from fullscreen to windowed will therefore cause a resize event to be received with the former fullscreen resolution after we have already setup the window to use the new resolution. If we don't ignore this event we end up with a texture size and a window size that are not consistent and for example see only a part of the texture (if the old resolution is bigger than the new one.
2016-03-16OPENGLSDL: Request "standard" GL contexts.Johannes Schickel
Compatibility profiles only exist in modern OpenGL and we request an ancient version.
2016-03-16OPENGLSDL: Destroy GL context on exit with SDL2.Johannes Schickel
2016-03-16OPENGL: Support GLES2 contexts.Johannes Schickel
2016-03-16OPENGLSDL: Slight cleanup.Johannes Schickel
2016-03-16OPENGL: Simplify context type setting.Johannes Schickel
2016-03-16OPENGLSDL: Try to use GL(ES) context SDL2 defaults to.Johannes Schickel
2016-03-16OPENGL: Support RGB555 for OpenGL ES output.Johannes Schickel
This mode should *not* be used by any new engines/code. If someone is going to use it and says it works with the OpenGL output, please make them wear a red uniform and beam them onto a remote planet.
2016-03-16OPENGL: Allow runtime specification of OpenGL mode.Johannes Schickel
Formerly, we required that the OpenGL mode was fixed at compile time. Now we allow the code to work with whatever it is given at runtime. It is still possible to force a context type on compile time.
2016-03-16OPENGL: Remove support for ARGB8888.Johannes Schickel
This used to be used by Sword25. Since it is not supported by GLES and no engine code uses it we drop support. Hopefully, this helps people to realize they should not use that format in their engine.
2016-03-16OPENGL: Add functionality to query OpenGL functions on runtime.Johannes Schickel
This can and will be used for future extension usage support. Tizen changes have been untested.
2015-12-13OPENGLSDL: Set proper mouse emulation dimensions.Johannes Schickel
Formerly we did not initialize the mouse emulation from SdlEventSource properly. Now hopefully joysticks etc. should work fine with the SDL OpenGL output too.
2015-12-12OPENGL: Refactor screen refresh handling.Johannes Schickel
Subclasses of OpenGLGraphicsManager are now supposed to supply a refreshScreen function which handles actual screen updating (for example, buffer swapping).
2015-12-08OPENGLSDL: Request GLES1.1 context with SDL2 for GLES targets.vanfanel
2015-05-16SDL: Add TODO about fullscreen modes to OpenGL SDL code.Johannes Schickel
2015-05-15SDL: Check for NULL when listing available modes via SDL_ListModesLittleboy
It can be returned when there are no dimensions available for the currently selected pixel format
2015-02-16SDL: Add basic abstraction class for the SDL window.Johannes Schickel
2015-01-25SDL: Add experimental support for SDL2.Johannes Schickel
This is based upon skristiansson's change set to make ScummVM work with SDL2.
2015-01-25SDL: Refactor WM specific functionality into SdlGraphicsManager.Johannes Schickel
2014-10-28BACKENDS: Remove trailing whitespaceFilippos Karapetis
2014-07-04OPENGLSDL: Don't ignore events after user-initiated resizes.Alyssa Milburn
2014-06-17OPENGLSDL: Move time stamp for last video mode set after fallback mode setup.Johannes Schickel
2014-06-17OPENGLSDL: Make workaround for fast resolution changes actually work for WME.Johannes Schickel
Thanks to fuzzie for noticing this.
2014-06-10OPENGLSDL: Always ignore bad resolution changes.Alyssa Milburn
Otherwise we can end up with the wrong resolution when we make multiple resizes in quick succession.
2014-02-12OPENGL/SDL: Default to RGBA8888 (memory layout).Johannes Schickel
This makes sure the default mode also works for OpenGL ES contexts.
2014-02-11OPENGL: Rename notifyContextChange to notifyContextCreate.Johannes Schickel
2014-02-11OPENGLSDL: Notify OpenGL manager about context destruction.Johannes Schickel
2013-10-24SDL: Further small cleanup related to manager switching.Johannes Schickel
2013-10-24SDL: Make activateManager/deactivateManager SdlGraphicsManager specific.Johannes Schickel
We can do this now that we can use virtual inheritance and dynamic_cast because we enabled RTTI.
2013-10-23SDL: Always initialize video subsystem in initSDL.Johannes Schickel
2013-10-23SDL: Clean up graphics manager switching slighty.Johannes Schickel
Sadly this also requires us to extend GraphicsManager for this SDL specific feature. However, since that's only used in the SDL backend and Tizen it should be fine for now...
2013-10-19OPENGL/SDL: Add screenshot support.Johannes Schickel
2013-10-19SDL: Use OSD in OpenGL SDL backend.Johannes Schickel
2013-10-19SDL: Add a OpenGL SDL backend and hook it into the SDL backend.Johannes Schickel
The hooking code is nearly exactly the old hooking code. Only the OpenGL SDL creation has been adapted since it uses a different constructor now.