Commit Graph
320 Commits
Author SHA1 Message Date
Laurent Merckx 741cd5ddc7 GRIM: use GL_UNSIGNED_SHORT for glDrawElements instead of GL_UNSIGNED_INT (not supported for GLES <= 2) 2020-11-12 05:58:36 +01:00
Cameron Cawley 03e8f0ed2d ENGINES: Remove code for toggling fullscreen mode (#2523)
* GRIM: Remove code for toggling fullscreen mode

* MYST3: Remove code for toggling fullscreen mode

* STARK: Remove code for toggling fullscreen mode

* ENGINES: Remove the fullscreen argument from initGraphics3d()
2020-10-14 07:49:28 +02:00
Cameron Cawley b19857bd8c ENGINES: Use ScummVM's 2D API for blitting the TinyGL framebuffer (#2516)
* GRIM: Use ScummVM's 2D API for blitting the TinyGL framebuffer

* MYST3: Use ScummVM's 2D API for blitting the TinyGL framebuffer

* ICB: Use ScummVM's 2D API for blitting the TinyGL framebuffer
2020-10-13 22:12:10 +02:00
Pawel Kolodziejski b8ae32d71b GRIM: Remove unused return value from GfxBase::setupScreen 2020-10-05 20:03:16 +02:00
Pawel Kolodziejski fb636cadde GRIM: Drop setting windows title with used renderer. 2020-10-05 07:59:10 +02:00
Pawel Kolodziejski 27e12d8a96 ALL: Eliminate LOCAL_PI macro 2020-09-23 23:20:23 +02:00
Bastien Bouclet f4e3bd0424 GRIM: Take adventage of kFeatureFullscreenToggleKeepsContext 2017-09-01 09:26:57 +02:00
Vincent Pelletier 198554a211 GRIM: Log front buffer pixel format on TinyGL initialisation 2017-05-15 10:31:25 +00:00
Vincent Pelletier e7073dc037 ALL: Add an option to control dirty rectangless TinyGL optimisation
Exposed to command line via --[no-]dirtyrects.
As dirty rectangles make the workload vary a lot between frames, it makes
performance regressions harder to spot. Disabling it produces lower, but
much more regular FPS counts.
2017-05-03 16:52:36 +00:00
Vincent Pelletier 1ca4e22223 GRIM: Use drawBitmap in GfxTinyGL::copyStoredToDisplay
Removes image down-sampling to texture resolution - much nicer !
2017-05-02 12:49:04 +00:00
Vincent Pelletier bad3de8a12 GRIM: Drop off-screen buffers
These were present to implement actor freezing in software rendering mode
in the way original engine was intended for performance reason.
In residualvm, software rendering will generalise the principle through
dirty-rectangles management, so off-screen buffers should not be needed.

Also, properly implementing them requires invasive changes (move previous
draw call list from global OpenGL context to individual off-screen buffers,
along with associated linear vertex allocator, adding a new draw call to
track requested buffer changes until final on-screen frame buffer
presentation).
So instead of such added complexity, lie to lua API about actor not being
in set but keep it in so it is part of normal redraw sequence.

Fixes disappearing actors in cn, bi.
Likely also fixes at, ly, sh, mn, dd which uses free/thaw lua API, but
which I did not check.
2017-05-02 09:51:47 +00:00
Vincent Pelletier d92e9581b4 GRIM: Use default clear depth
For consistency with OpenGL.
2017-05-01 03:19:45 +00:00
Vincent Pelletier ee66143a90 GRIM: Disable lighting in GfxTinyGL::drawEMIModelFace
As is done for OpenGL. It allows TinyGL to take shortcuts in coordinates
transformations of all vertices.
Also, reduce trivial diffs with gfx_opengl.cpp .
2017-05-01 03:19:45 +00:00
Vincent Pelletier a0886193f0 GRIM: Do not convert type-1 bitmap data on submission
Instead, generate color key in a consistent pixel format.
2017-04-29 15:17:37 +00:00
Vincent Pelletier 090dc58a83 GRIM: Drop outdated comment
This came from code in TinyGL which was removed during the 32bits works,
but I forgot to remove this comment.
2017-04-29 14:40:14 +00:00
Vincent Pelletier 8fc17a49e2 GRIM: {T,}GL_LINES does not need to be interrupted between each line 2017-04-28 21:55:36 +00:00
Vincent Pelletier a8612e130f GRIM TINYGL: Do not force conversion to RGBA8888
createScreenshotBitmap internally converts to RGB565 anyway.
2017-04-26 13:11:00 +00:00
Vincent Pelletier f8ef0b2261 GRIM: Draw to buffer before storing display
Fixes save game screenshots with TinyGL: without this, the screenshot
content is the menu at the time user confirmed the save, and not the
original scene.
This is consistent with OpenGL behaviour, where framebuffer-reading
operations implicitly call glFlush.
2017-04-25 11:31:49 +00:00
Vincent Pelletier a3a6218060 GRIM: Avoid writing to buffer directly. 2017-04-23 01:44:51 +00:00
Pawel Kolodziejski c00c43dfcd GRIM: Added comment regarding working blending without enabling in RGB565 mode case 2016-07-23 18:18:11 +02:00
Vincent Pelletier 49259659e1 GRIM: Enable blending around Graphics::tglBlit calls.
For some reason blending happens in RGB565 even without blend enabled.
Prepares for 32bits color support.
2016-07-23 17:46:01 +02:00
Vincent Pelletier 7c1a15c6e8 TINYGL: Expect colorKey in the same pixel format as surface.
So caller does not have to depend on the pixel format used internally to
BlitImage.
Update callers which do request for color keying (GRIM/EMI only).
Also, remove a special-casing of transparent color when converting image
format which sets a color in a packed format independent from actual
destination format.
Also, in GfxTinyGL::createTextObject, prefer changing invisible colorKey
value than actually-visible color.
2016-07-21 16:17:32 +02:00
Paweł Kołodziejski 9acb1b9039 Merge pull request #1275 from vpelletier/valgrind
TINYGL, GRIM: Fix various errors (mostly memory leaks) found by valgrind
2016-07-20 14:09:52 +02:00
Paweł Kołodziejski d467980499 Merge pull request #1262 from vpelletier/tinygl_dirty2d
GRIM: Fix drawLine/Rect/Polygon in TinyGL renderer
2016-07-18 05:17:35 +02:00
Vincent Pelletier f12cb15801 GRIM: release movie frame in GfxTinyGL::~GfxTinyGL. 2016-07-18 04:36:37 +02:00
Vincent Pelletier 21c3d9234f GRIM: Delete emergency font before calling glClose.
So TinyGL knows it can free underlying structures.
2016-07-18 04:36:37 +02:00
Vincent Pelletier c4d884967c GRIM: Reuse existing blit image.
Fixes a memory leak when playing videos: each frame would leak as the
previous one does not get reused or freed.
2016-07-17 06:38:35 +00:00
Vincent Pelletier a0201afc37 GRIM: Enable TGL_ALPHA_TEST in GfxTinyGL::drawSprite. 2016-07-15 12:43:06 +00:00
Vincent Pelletier 9b7548ccf7 GRIM: Enable alpha test in GfxTinyGL::drawModelFace.
Fixes the appearance of textures using alpha (ex: game card).
2016-07-14 15:36:33 +00:00
Paweł Kołodziejski 863548efeb Merge pull request #1261 from vpelletier/tinygl_texture_matrix
Tinygl texture matrix
2016-07-14 09:57:52 +02:00
Bastien Bouclet 420f19d6de GRIM: Remove useless assignments to g_driver 2016-07-12 06:16:35 +02:00
Vincent Pelletier 84859619f1 GRIM: Use [T]GL_LINE_LOOP to display an empty rectangle.
Reduces vertex redundancy.
In TinyGL, fixes checkbox border on Copal computer (actually, works around
yet another discrepancy between OpenGL and TinyGL on 1-pixel-thick
[T]GL_QUADS).
2016-07-11 14:52:36 +00:00
Vincent Pelletier 4c41a1e4a5 GRIM: Reduce direct framebuffer drawing with TinyGL.
Before this change, drawRectangle, drawLine and drawPolygon directly drew
to framebuffer, bypassing all TinyGL dirty-region detection and handling.
As a result, these drawings would only be visible when forcing TinyGL to
refresh the entire window.
Copy code from OpenGL renderer and do minor tweaks to make TinyGL happy.
There are still glitches (checkboxes on Domino's computer, ticket
printer digits) but something decent (correct position & size) gets
rendered.
2016-07-11 00:09:39 +00:00
Vincent Pelletier 41f50c2ba0 GRIM: Get rid of a few TinyGL-only lines.
Now that TinyGL behaves better around matrices, these lines become
superfluous.
2016-07-10 13:25:20 +00:00
Bastien Bouclet 3f295ec773 GRIM: Check at runtime that shaders are available 2016-02-06 08:53:42 +01:00
Bastien Bouclet 31715787ca SYSTEM: Add a system method for retrieving the screen framebuffer 2016-02-06 08:53:41 +01:00
Vincent Pelletier ea8245696b GRIM,EMI: Scale intensity on change instead of for each frame
Also uniformises intensity scaling factor implementation across renderers.
Maintain saved-state compatibility by computing on restore.
2016-01-01 23:07:59 +01:00
Paweł Kołodziejski 0eb20ae8d5 Merge pull request #1177 from vpelletier/for_upstream
GRIM: Assorted lighting fixes
2015-08-16 08:53:18 +02:00
Christian Krause b186c21f85 EMI: Fix wrap around of Layers/Frames
This patch makes sure, that Layer::_frame is smaller than numLayers
of the bitmap in order to prevent out-of-bounds access to
BitmapData::_layers.
2015-05-16 10:39:08 +02:00
Vincent Pelletier faad6a1fe3 GRIM: Disable quadratic attenuation for spotlights.
Enabling quadratic atenuation, even with values as low as 0.1, reduces spot
lighting too much in (at least) sets "do" (see Domino), "al" (see Manny when
walking along the garage door), "hq" (see Salvador).
Disabling is not perfect either, as attenuation can be seen (at least) in
set "tu" (see fire extinguisher), but it should be overall better.

Also, it should be noted that perfect fidelity cannot be achieved with openGL
fixed pipeline, as DirectX spotlight have two angles (0 <= phi <= theta <= pi),
atenuation being null below phi, full above theta, transitioning with a
configurable exponent between both (defaults to angle-linear). OpenGL would
correspond to phi=0 and theta=pi (ie, transition is always done between fixed
angles), plus a configurable hard cutoff.
2015-05-06 19:49:42 +02:00
Vincent Pelletier 351a4efa8a GRIM: Tweak attenuation.
Determined by enabling a single omnidirectional light (newlight9 in set
"ce", which stands at set entrance toward elevator) and comparing
luminosity level on Manny at several locations in that scene with original
software renderer.
This set is quite convenient for this comparison, as Manny position can be
easily controlled: stick to the wall with the red arrow pointing at the
stairs, making movements one-dimensional.

For spotlight, set "tu" was used with the single spotlight on, walking
from the fire extinguisher to server door, confirming similar attenuation.

From these tests, it seems only quadratic attenuation is used, which makes
sense as it gives a realistic effect.
2015-05-06 19:49:42 +02:00
Vincent Pelletier 06e7aa68b0 GRIM: Correct diffuse reflectance.
Determined by keping a single directional light source enabled, as they are
not subject to attenuation (having no position), and comparing with
original software renderer.
Default DirectX material reflects all diffuse light, so 1.0f coefficient is
likely correct.
2015-05-06 19:49:42 +02:00
Vincent Pelletier f36d2b62f8 GRIM: Drop TinyGL-only intensity divisor.
Also, divide intensity once instead of once per component.
2015-05-06 19:49:42 +02:00
Vincent Pelletier 5c0d8ae30e GRIM: Set correct cutoff angle now that TinyGL renders spots correctly.
Also, set (T)GL_SPOT_EXPONENT as in OpenGL renderer.
2015-05-06 19:49:42 +02:00
Christian Krause d7e7ee214d GRAPHICS: Enable drawing of bitmaps/tiles with just one sub-image
Instead of using the number of sub-images to decide whether bitmaps
should be drawn using TIL information, better use the existance
of texture coordinates which are distinctive for tiles.
2015-05-05 23:19:16 +02:00
Christian Krause a8460f4f3f EMI: Check bit in mesh face flags to disable lighting
Use bit 0x20 in the mesh face flags to disable ligthing. This
fixes the problem that once a previous screen is used as
texture (e.g. in the intro or for the transition effects
in set kab when walking eastwards or westwards), it is shown
too dark due to the applied static lighting for overworld
actors.
2015-02-24 22:49:48 +01:00
Christian Krause 6d226501b5 EMI: Implement mesh-specific alpha values
- if Lua_V2::SetActorGlobalAlpha() is called with a mesh name,
  set a mesh-specific alpha value / mode
- use this alpha value in drawEMIModelFace()
- fixes the problem that the whole actor vanishes in some scenes
  (e.g. when entering or leaving the porch of the of LUA bar)
2015-02-17 01:57:07 +01:00
Christian Krause 789da551fc GRIM/EMI: Add nullptr checks to avoid segfaults on cleanup 2015-01-13 21:12:23 +01:00
Christian Krause ad2ce4a87e EMI: Fix memleaks caused by specialtyTextures
- delete screenshot after texture is created
- free _data[] entries in BitmapData::freeData()
- destroy _specialtyTextures[] entries in
  graphic driver's destructors
2014-12-31 15:47:36 +01:00
Pawel Kolodziejski a37e7bc204 GRIM: fixed TinyGL draw sprites 2014-12-28 17:11:13 +01:00