Commit graph

133 commits

Author SHA1 Message Date
Kp 173d5559d7 Tighten TGA generation code
- Skip reading unused alpha channel in TGA screenshot path.  The alpha
  channel is discarded, so skip even retrieving it from OpenGL.
- Perform the red/blue swap in place, instead of copying into an
  additional buffer.
2022-07-02 18:10:45 +00:00
Kreeblah 5b9b353231
Added high DPI flag to SDL 2.0 builds for macOS 2021-12-22 14:26:05 -08:00
Kp 157ec66668 Remove useless cast in DXX_USE_OGLES path in ogl_init_window
This triggers a diagnostic from -Wuseless-cast.  It appears to be
unnecessary, after tracing down typedefs.  It might need to be restored
if some platform uses a definition that is neither the same type nor
implicitly convertible.
2021-12-19 19:35:11 +00:00
Kp 93e98ae71a Fix -Wold-style-cast in DXX_USE_OGLES code 2021-12-19 19:26:44 +00:00
Kp 5491630142 Pass canvas to ogl_texture_stats 2021-09-19 10:53:48 +00:00
Kp ae3dc7f934 Simplify computed color reset
gr_find_closest_color did not need it.  Remove it.  For the others,
resetting the count is sufficient.  There is no need to reset the
individual elements.
2021-09-04 12:17:14 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 969caa8c0c Add configure test to check for usable GL utility library
Rebirth built with OpenGL has a hard dependency on the GL utility
library, but did not have a configure time test to report this.  Add
one.

Reported-by: shoober420 <https://github.com/dxx-rebirth/dxx-rebirth/issues/468>
2020-09-11 03:08:02 +00:00
Kp 6285878c4c Add color_palette_index type alias, to note palette-related uint8_t 2020-07-16 02:31:04 +00:00
Kp b39c7c4ed2 Move ogl_swap_buffers_internal to dcx 2020-07-05 23:34:32 +00:00
Kp db7b4b3f88 Refer to <memory> directly, not through "compiler-make_unique.h" 2020-05-02 21:18:43 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
ziplantil 639d33b4de reorder palfx logic; use inline func in gr_palette_step_up 2019-07-28 12:47:24 +03:00
ziplantil 4f3b2a1520 make alast_* function-local 2019-07-28 01:41:37 +03:00
ziplantil f446790b03 optimize; abs no longer necessary 2019-07-28 00:49:30 +03:00
ziplantil 4eab54284c change palfx code; special only for all < 0 (cloak) 2019-07-28 00:42:37 +03:00
ziplantil 3753e5942d fix effect (on GL) when picking up cloak 2019-07-27 23:38:34 +03:00
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp f491059ed7 Enable building with SDL2
This commit enables Rebirth to build with SDL2, but the result is not
perfect.

- SDL2 removed some sticky key support.  Rebirth may behave differently
  now in this area.
- SDL2 removed some key-repeat related support.  Rebirth may behave
  differently now in this area.
- SDL2 gained the ability to make a window fullscreen by sizing it to
  the desktop instead of by changing the desktop resolution.  Rebirth
  uses this, and it mostly works.
  - Resizing while in the automap does not notify the automap code, so
    the view is wrong until the player switches out of automap mode and
    back in.
- SDL2 changed how to enumerate available resolutions.  Since
  fitting the window to the desktop is generally more useful than
  fitting the desktop to the window, I chose to drop support for
  enumerating resolutions instead of porting to the new API.  Users can
  now enter an arbitrary window dimension and Rebirth will make an
  attempt to use it.
  - It might be useful to cap the window dimension at the desktop
    dimension, but that is not done yet.
  - Entering fullscreen mode through the Controls->Graphics submenu
    failed to notify the relevant subsystems, causing the rendered
    content not to rescale.  For now, compile out the option to toggle
    full screen through that menu.  Toggling through Alt+Enter works
    properly.

Despite these quirks, this is a substantial improvement over the prior
commit, where SDL2 cannot be used at all.  The remaining issues can be
resolved in future work.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
Ronald M. Clifford a9fb3c9df9 Add missing glDisableClientState call. 2018-04-22 23:31:27 -07:00
Kp 131c1b9f4d Add support for PNG screenshots 2018-02-18 00:42:42 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp d049f738c8 Convert various gr_set_current_canvas calls to reference form 2017-11-05 20:49:08 +00:00
Kp ca804d5186 Clear canvas to fix missing exit tunnel movie
Global variable `grd_curcanv` is set to a variety of canvases, some of
which are local stack variables.  Use of global variables in this way is
fragile, but works as long as the global is not used beyond the life of
the backing local.

Unfortunately, some existing uses do access the canvas beyond the
lifetime of the backing local.  Playing movies sets the font of the
current canvas.  If the current canvas is an expired stack variable,
setting the font overwrites other stack data.  This data corruption
causes various symptoms, such as inability to play the escape tunnel
movie.

Prior to 03cca2b3dc, the corruption on
playing the endlevel movie had no user-visible effect.  That commit
created a large local variable, which changed stack layout.  Starting
with that commit, the corruption causes the movie to play as all black.

Fix this, and protect against some other data corruption possiblities,
by clearing the global when the local goes out of scope.

Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/345> (only as cutscene failure to play, not as the underlying corruption issue)
2017-11-05 20:49:08 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.

git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
2017-11-05 20:49:08 +00:00
Kp 6b209c8713 Decorate OpenGL messages
Some Linux libraries print their own messages to stdout/stderr,
particularly in case of severe errors.  Decorate messages generated by
Rebirth to distinguish them from library generated messages.

For specific blacklisted renderers, add a message informing the user
that the blacklist matched and changed settings.
2017-08-26 19:47:51 +00:00
Kp dc33a58225 Use array<> in more places 2017-07-08 18:17:49 +00:00
Kp a7e0e05e19 Rename vertex_array -> vertices
Future work will introduce a typedef vertex_array.  That typedef would
cause these uses to trigger a -Wshadow warning.
2017-07-08 18:17:49 +00:00
Kp 9311548eba Pass grs_bitmap to ogl_upixelc 2017-03-11 19:56:23 +00:00
Kp 393e96b8d8 Unify SDL/OGL save_screen_shot
This simplifies maintenance and reduces the potential for inconsistency.
It also cleans up one existing inconsistency.
2017-03-10 01:22:27 +00:00
Kp 1ed06c91b7 Pass canvas to ogl_ulinec 2016-12-29 03:27:09 +00:00
Kp fee4346dc1 Pass canvas to ogl_urect 2016-12-29 03:27:08 +00:00
Kp 290cb6e7c0 Use array<> for ogl_urect float arrays 2016-12-29 03:27:08 +00:00
derhass 551570d29b Unify OpenGL extension handling between OpenGL and OpenGL ES code paths.
Split ogl_get_verinfo() into ogl_tune_for_current() and
ogl_extensions_init(), and consolidate all the OpenGL extension handling
into ogl_extensions.cpp. Unify the code paths for texture anisotropy and
GPU synchronization for OpenGL and OpenGL ES.

Currently, our renderer only uses GLES 1.0, so no real world implementation
will support sync objects for such an old context, but the logic is valid,
and this way, the GLES specific code paths are reduced.

This patch also fixes an issue where the old ogl_get_verinfo() did modify
the texture filtering mode if no anisotropic filter was available. This
was some leftover from the time when the anisotropic filter was a just
a specific CGameConfig.TexFilt mode, and not a separate, orthogonal setting
CGameCfg.TexAnisotropy that it is now.
2016-11-03 21:59:11 +01:00
derhass b144badb11 fix old-style casts in the DXX_USE_OGLES code paths 2016-10-29 23:58:28 +00:00
Kp d955eda96f Fix fullscreen checkbox handling
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/224>
Fixes: 7128141c55 ("Use enum for newmenu item type")
2016-10-18 02:26:30 +00:00
Kp a468e2612b Factor out gr_set_attributes SDL_GL_SetAttribute calls 2016-10-02 19:35:34 +00:00
Kp 797554f80a Move Multisample to CCfg 2016-10-02 19:35:33 +00:00
Kp b8f58309f0 Reuse computed filename for screenshot 2016-10-02 00:34:49 +00:00
Kp 2289ed473d Unify computing write_bmp output size requirement 2016-10-02 00:34:49 +00:00
Kp 3544ea097d Move OGLES to dxxsconf.h; rename to DXX_USE_OGLES
Rename symbol OGLES to DXX_USE_OGLES to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGLES -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGLES/\1 DXX_USE_OGLES/' -e 's/\(\s*#\s*if\)ndef OGLES/\1 !DXX_USE_OGLES/'
2016-09-24 18:06:11 +00:00
Kp 3fc1441b3f Remove unused Win32 OpenGL indirections 2016-09-04 19:10:43 +00:00
Kp 53196ec990 Switch similar/arch/ogl to C++ casts 2016-09-04 00:02:53 +00:00
Kp 30a7c28cc5 Switch gr.cpp write_bmp to static_cast 2016-09-04 00:02:51 +00:00
Kp 9b3adfb020 Remove useless casts in similar/arch/ogl/gr.cpp 2016-08-17 04:44:22 +00:00
Kp a1ab71f5ad Avoid calling make_unique<...>({})
The compiler may or may not recognize that the temporary T{} passed to
make_unique can be omitted.  Help it by passing nothing, then explicitly
clearing the returned data as a separate step.
2016-08-06 19:55:24 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp b0a2205a4e Convert various pointer casts to reinterpret_cast 2016-07-06 01:54:24 +00:00
Kp b282bea173 Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-05 01:04:26 +00:00