Commit graph

201 commits

Author SHA1 Message Date
Cameron Cawley
d289fa5f98 OPENGL: Ensure surfaces created by saveScreenshot are the right way up 2020-01-02 20:53:29 +02:00
sluicebox
b8390fa161 GRAPHICS: Add interface for horizontal shake 2019-11-19 00:20:40 +01:00
Cameron Cawley
d1fa1154fe BACKENDS: Fix using fillScreen in non-paletted screen modes 2019-11-10 01:25:46 +02:00
Cameron Cawley
177d709909 OPENGL: Implement high DPI support on Android (#1895)
* OPENGL: Implement high DPI support on Android

* PSP2: Fix build
2019-11-01 13:39:46 +02:00
Jaromir Wysoglad
bbbb608c52 TTS: Implement OSD message reading 2019-09-01 22:47:55 +03:00
Cameron Cawley
1feb86ee97 BACKENDS: Handle screen shaking in WindowedGraphicsManager 2019-08-15 02:01:21 +03:00
Cameron Cawley
d765440c1a OPENGL: Support RGBA8888 swapped textures when using OpenGL ES 2019-08-04 18:46:30 +01:00
Cameron Cawley
16f8c024d1 OPENGLSDL: Move stretch mode handling into OpenGLGraphicsManager 2019-06-24 02:19:28 +03:00
Cameron Cawley
0ddfe927ce OPENGLSDL: Move getSupportedFormats into OpenGLGraphicsManager 2019-06-22 01:15:39 +03:00
Cameron Cawley
205df5dbdf IMAGE: Fix taking screenshots on big endian systems 2019-03-02 07:29:22 +01:00
Cameron Cawley
8ae17b481a IMAGE: Move bitmap writing code out of OpenGLGraphicsManager 2019-03-02 07:29:22 +01:00
Bastien Bouclet
3376597abd OPENGL: Use premultiplied alpha for color-keyed cursors
This fixes colour fringing on keyed cursors when using filtering.

Fixes Trac#10594.
2018-08-26 21:08:40 +02:00
Colin Snover
5c855a0a5a BACKENDS: Fix shake position getting stuck
If a game is doing a screen shake (for example, DOTT when the
stereo is on), and the user does an RTL, the screen shake offset
may get stuck if the engine does not reset it on shutdown. To
avoid this in all cases, just always reset the screen shake
whenever the graphics manager is told to switch to a new graphics
mode.
2017-12-01 19:43:12 -06:00
Colin Snover
5d8cf6ba42 BACKENDS: Fix GraphicsManager handling of empty cursors
The SDL graphics manager was just ignoring calls from CursorMan to
set the cursor to a blank cursor, which meant engines that did not
immediately send a cursor to CursorMan at startup would still show
the launcher's cursor (usually with a broken palette).

The OpenGL graphics manager would try to generate and draw an
invalid cursor surface when receiving an empty cursor.
2017-10-15 13:24:20 -05:00
Colin Snover
da0a8db704 BACKENDS: Also hide mouse cursor outside game area when an engine has hidden the cursor
The only reason we show the system cursor outside the game area is
to show users where their mouse is when the window is resized and
the mouse is outside the game area. If the game cannot be
interacted with, then the mouse also does not need to be shown in
the black areas.
2017-10-15 13:24:20 -05:00
Colin Snover
de2bbe3b97 BACKENDS: Refactor OpenGL & SDL graphics backends
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-15 13:24:20 -05:00
Bastien Bouclet
8e4697946e OPENGL: Always clear the whole backbuffer
Previously we were clearing the whole backbuffer for 3 frames after a
window size change, and then only clearing the game area. This assumes
the OpenGL driver uses at most 3 render buffer and uses them in
sequential order. This does not seem to be the case on Linux when using
an Intel integrated GPU.
Instead we now clear the whole backbuffer on each frame to make sure
there are no leftovers remaining on the screen. All semi-recent GPUs
should have hardware clear anyway so this should not impact negatively
performance.

Possibly fixes #10025.
2017-08-05 08:36:32 +02:00
Colin Snover
fa0bb7dd5a BACKENDS: Compress screenshots using PNG if available
Closes gh-948.
2017-05-21 15:55:39 -05:00
Bastien Bouclet
23abcffbc5 OPENGL: Don't update the cursor's texture when the cursor is invisible
Updating the cursor's texture is not necessary if it is not going to be drawn.

Fixes glDrawArrays sometimes failing due to using a framebuffer with an
incomplete color attachment. In SCI32 games, the framebuffer is incomplete
because the engine does not define pixel data for the cursor.
2017-05-08 06:50:30 +02:00
Thierry Crozat
a9ae691513 SDL: Improve debug and warning messages when saving screenshots
In particular this adds a warning when failing to save a screenshot
in OpenGL mode (there was already one in SurfaceSDL mode).
2017-04-24 01:07:16 +01:00
Thierry Crozat
cbfa598446 OPENGL: Remove hack to avoid issues with OSD messages from other threads 2016-10-29 15:13:32 +01:00
Thierry Crozat
c6ce1c8002 OPENGL: Add support for filtering feature
This replaces the two graphics modes "OpenGL (No filtering)" and
"OpenGL". Now there is a single "OpenGL" mode and filtering is
controlled by the kFeatureFilteringMode.
2016-10-13 01:45:01 +01:00
Bastien Bouclet
5e133cdd34 OPENGL: Make sure the cloud icon is cleared immediatly after it is hidden 2016-09-18 17:55:09 +02:00
Bastien Bouclet
75599a4c25 OPENGL: Remove multithread support from displayActivityIconOnOSD
It is no longer being called by another thread.
2016-09-18 17:55:09 +02:00
Thierry Crozat
2d651fd0f4 OPENGL: Fix dereferencing null pointer in OpenGLGraphicsManager
This fixes a crash when calling displayActivityIconOnOSD with a
NULL icon, which is used to remove the current activity icon.
2016-09-13 22:58:13 +01:00
Bastien Bouclet
9cbaad6140 SDL: Switch the OpenGL renderer to use small textures to draw the OSD 2016-09-13 20:41:26 +02:00
Thierry Crozat
a8cb3c8404 OPENGL: Implement getOSDFormat and copyRectToOSD 2016-09-05 21:40:45 +01:00
Thierry Crozat
65d3c15b01 OPENGL: Add missing USE_OSD defined checks around OSD code 2016-09-05 21:21:32 +01:00
Alexander Tkachev
1b9987ddc9 GUI: Add getOSDFormat() and make OSD 32 bpp 2016-08-24 16:07:55 +06:00
Alexander Tkachev
2a15b8b280 GUI: Add clearOSD() method
So one can erase everything from OSD and then blit something on it.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
7ff1f91808 GUI: Add copyRectToOSD()
I was lazy to implement that in OpenGLGraphicsManager and I'm not sure
it's implemented correctly in SurfaceSdlGraphicsManager, but it works
for me.
2016-08-24 16:07:55 +06:00
Johannes Schickel
3f9852eb20 OPENGL: Make shader pipelines use fixed shaders. 2016-03-16 20:29:31 +01:00
Johannes Schickel
26f106497a OPENGL: Implement CLUT8 look up as Pipeline. 2016-03-16 20:29:30 +01:00
Johannes Schickel
8a4938f82b OPENGL: Move pipeline code to pipelines/. 2016-03-16 20:29:30 +01:00
Johannes Schickel
ed6689d4fc OPENGL: Do not allow direct access to Context::activePipeline. 2016-03-16 20:29:27 +01:00
Johannes Schickel
b17c035642 OPENGL: Implement texture drawing in Pipeline instead of Surface. 2016-03-16 20:29:27 +01:00
Johannes Schickel
0fe580d10c OPENGL: Make shader/framebuffer part of pipeline state. 2016-03-16 20:29:27 +01:00
Johannes Schickel
0b46af2f0e OPENGL: Don't prefix maxTextureSize variable for consistency. 2016-03-16 20:29:27 +01:00
Johannes Schickel
c4e65732be OPENGL: Introduce abstraction for framebuffer.
This allows us to use various framebuffer settings easily. Now the GPU
accelerated CLUT8 surface implementation does not need to query former
framebuffer state anymore.
2016-03-16 20:29:26 +01:00
Johannes Schickel
5498982a37 OPENGL: Introduce ShaderManager to handle builtin shaders. 2016-03-16 20:29:26 +01:00
Johannes Schickel
f5f1b6eba0 OPENGL: Introduce pipeline abstraction to cleanup code. 2016-03-16 20:29:26 +01:00
Johannes Schickel
08553a09cf OPENGL: Support GLSL based CLUT8 look up for GLES2+. 2016-03-16 20:29:26 +01:00
Johannes Schickel
18306ee206 OPENGL: Simplify shader support checks. 2016-03-16 20:29:26 +01:00
Johannes Schickel
2319fcd228 OPENGL: Handle GLES2 and GL shaders uniformly.
GLES2 requires precision qualifiers to be set and allows use of precision
qualifiers. For GLES2 we define a default precision now. Since precision
qualifiers are not supported in the GLSL version we use for GL, we
introduce compatibility #defines.
2016-03-16 20:29:26 +01:00
Johannes Schickel
e66e9e44d3 OPENGL: Accelerate palette lookups with shaders.
This currently is limited to GL contexts.
2016-03-16 20:29:26 +01:00
Johannes Schickel
de3846923c OPENGL: Introduce simple abstraction for surfaces.
This is basically an interface extracted from Texture without any knowledge
about any actual implementation, except for copyRectToTexture, fill, and
dirty rect handling. These are convenient helpers.
2016-03-16 20:29:26 +01:00
Johannes Schickel
618adec7b0 OPENGL: Move color key handling for CLUT8 to TextureCLUT8. 2016-03-16 20:29:26 +01:00
Johannes Schickel
db2917dde5 OPENGL: Fix texture format for BGR565. 2016-03-16 20:29:26 +01:00
Johannes Schickel
9844d89231 OPENGL: Move max texture size information to Context. 2016-03-16 20:29:26 +01:00
Johannes Schickel
8a3eecb73a OPENGL: Unify shader implementation for GL and GLES2. 2016-03-16 20:29:25 +01:00