Commit Graph

136 Commits

Author SHA1 Message Date
Chris Sarbora
bd06bf5288
rename ogl* to dgl* 2024-08-18 02:49:06 -05:00
Louis Gombert
ae5840f314
Merge pull request #502 from winterheart/modules-split
Splitting submodules of project
2024-07-30 23:17:47 +02:00
Louis Gombert
1328a8c846 Remove non-functional OpenGL logging methods 2024-07-28 17:52:01 +02:00
Azamat H. Hackimov
7ba009b811 Isolate rtperformance module
Update rtperformance module, minor cleanups.
2024-07-28 16:50:42 +03:00
Chris Sarbora
3da53e567f
Programmatically replace all __LINUX__ with POSIX
Steps:
```sh
srcs=$(mktemp)
find . -name "*.cpp" -or -name "*.c" -or -name "*.h" -or -name "*.hpp" -or -name "*.cc" -or -name "*.hh" > $srcs
xargs sed -i 's/ifndef __LINUX__/if !defined(POSIX)/' < $srcs
xargs sed -i 's/ifdef __LINUX__/if defined(POSIX)/' < $srcs
xargs sed -i 's/defined(__LINUX__)/defined(POSIX)/' < $srcs
```
2024-07-12 18:11:54 -05:00
Azamat H. Hackimov
7b7ffde4d8 Fix loading OpenGL library on Windows
On loading GL symbols we are using SDL_GL_GetProcAddress(), which only valid if we previously loaded OpenGL library with SDL_GL_LoadLibrary(). We cannot use mod_LoadModule() here, otherwise finding symbols will fail.
2024-06-29 20:53:13 +02:00
Louis Gombert
74c7b2cb0c Fix bad rebase for sdlmain.cpp 2024-06-29 18:28:23 +02:00
Louis Gombert
5d413b9f30 Fix bad __LINUX__ checks 2024-06-29 18:28:22 +02:00
Louis Gombert
97540db0ae Fix Linux opengl library load 2024-06-29 18:21:38 +02:00
Louis Gombert
6f5a4be1e6 Fix Windows OpenGL dynamic loading 2024-06-29 18:21:37 +02:00
Louis Gombert
91c18fefc5 Windows SDL2 compilation 2024-06-29 18:21:37 +02:00
Azamat H. Hackimov
59487976f6 Isolate misc module
Isolate misc module for better dependency handling.
2024-06-27 01:26:35 +03:00
Louis Gombert
3b7a6cc17c
Merge pull request #467 from JeodC/upstream
Set default BPP to 32
2024-06-24 19:48:11 +00:00
JeodC
310412a360 Set default BPP to 32
In windows x64, on trying to run the game, ChangeDisplaySettings will fail because the game does not use the new windows api to change these settings. Since Win95 compatibility mode is not an option for Win64, instead change the default BPP to 32.

There may be a more proper way to handle this, and make it more uniform to remove BPP 16 entirely, but this has worked for me since putting it in a fork over a month ago.
2024-06-24 11:04:02 -04:00
Thomas Roß
62784c40c4 [Renderer] Added g3_GetAspectRatio() and made g3_SetAspectRatio() available through 3d.h to prevent use of extern. 2024-06-22 17:59:27 +02:00
Azamat H. Hackimov
db8aa64d2f Make mem module isolated from project
Properly define MEM_USE_RTL definition only for mem library. Link other dependant modules with mem.
2024-06-20 00:43:51 +03:00
Ryan C. Gordon
393a39b709
opengl: use SDL_WINDOW_FULLSCREEN_DESKTOP and an FBO.
This now renders to an OpenGL Framebuffer Object at the game's resolution,
and blits it to the window at whatever resolution it is currently using,
scaling and letterboxing if necessary.

Which is to say: display resolutions are now imaginary, and we never change
the physical display mode now. A smaller resolution is simply drawing less
pixels and scaling them up with the GPU for display. This solves a few
problems: no more resizing background windows or desktop icons shuffling
around, no more being stuck in a weird resolution when debugging or if the
game crashes, no more waiting on monitors to click over to a new mode, and
no more weird rendering when the display didn't exactly support the requested
mode.

This also means the game doesn't have to drop down to 640x480 for the config
menu screen when it was otherwise using some other resolution.

Some caveats:

- This _requires_ OpenGL Framebuffer Object support; there is currently no
fallback if it's missing and the game will refuse to start. But any desktop
hardware of the last ~20 years should support it. For weird embedded things
or whatnot, it will be possible to add a fallback.

- This currently requires SDL. The OpenGL pieces should work on Windows, but
someone would need to adjust the existing win32 code to create a fullscreen
window and not change the physical display mode. It should still compile on
windows and work as before (untested by me, though).

- This is only OpenGL; it does not touch the Direct3D renderer, which should
continue to work as before (again, untested by me).
2024-06-14 03:56:49 -04:00
GravisZro
f7ae658fe2 Modernize struct/enum/unions type declarations 2024-05-30 03:35:17 -04:00
GravisZro
a6f4b5c115 Fix -nomousegrab flag
HardwareOpenGL incorrectly has "-nomousecap" instead of "-nomousegrab"
2024-05-28 17:13:06 -04:00
GravisZro
9cf9781369 Properly format/use variadic macros 2024-05-24 20:57:17 -04:00
Azamat H. Hackimov
a0929aefe2 Rename ddio_common to ddio 2024-05-24 22:18:14 +03:00
Azamat H. Hackimov
6bc3c71a83 Reordering ddio_common module
Merge ddio_lnx and ddio_win into ddio_common module.
2024-05-24 22:17:44 +03:00
GravisZro
5e5e0c99c3 Replace "short" with "int16_t" and fix missing headers 2024-05-23 23:49:31 -04:00
GravisZro
aebe1bbbb6 Replace "ushort" with "uint16_t" and fix missing includes 2024-05-23 23:16:40 -04:00
GravisZro
26b7776f43 Replace "ubyte" with "uint8_t" 2024-05-23 23:07:26 -04:00
GravisZro
9d3e361a35 Replace "sbyte" with "int8_t" 2024-05-23 23:05:05 -04:00
GravisZro
a3a3797067 Replace "uint" with "uint32_t" 2024-05-23 22:57:25 -04:00
Azamat H. Hackimov
3fa32ff386 Reorder headers related to linux module 2024-05-19 12:21:43 +03:00
Jeod
01db899f56
Merge pull request #342 from Lgt2x/remove-ddaccess
Remove DDAccess.h header, and associated DD_ACCESS_RING definition
2024-05-15 17:42:05 -04:00
Thomas Roß
9204b075ed [Renderer] Fixed double delete/free in rend_Screenshot(). 2024-05-14 21:24:01 +02:00
Louis Gombert
dc138e4912 Remove DDAccess.h header, and associated DD_ACCESS_RING definition
This definition was used to control the accessibility of some class members, changing protected qualifiers to public. This introduced unnecessary coupling between components and headers.

All conditional access specifiers have been set to public, which should not be a problem given the low number of classes that actually used affected members. Another albeit more complex solution could have been to use friend classes.
2024-05-13 23:21:05 +02:00
Edu García
23abc42faa OpenGL fix for certain drivers/cards 2024-05-11 22:34:05 +01:00
Edu Garcia
f793797088
Merge pull request #325 from Arcnor/png-screenshot
Save screenshots as PNG
2024-05-09 23:22:30 +01:00
Louis Gombert
43b11574fd
Merge pull request #323 from Arcnor/renderer-refactor2
Renderer refactor 2
2024-05-10 00:07:13 +02:00
Edu García
80c207d41c save screenshots as PNG 2024-05-09 22:46:17 +01:00
Edu García
20e6f4d915 [gl] extracted some common GPU rendering code (polygon rendering functions) 2024-05-09 13:16:01 +01:00
Edu García
fc55671f61 [gl] use single structure for vertex data 2024-05-09 13:16:01 +01:00
Edu Garcia
1f94e623b2
Merge pull request #315 from Arcnor/renderer-refactor
Renderer refactor
2024-05-09 13:15:22 +01:00
Edu García
860c9e8826 [gl] cleanup 2024-05-09 12:19:00 +01:00
JeodC
a4ab78192c Join license header with historical commentrs
Join the license header with historical comments using a separator so IDEs can correctly parse the initial header.

Also use .gitattributes to ensure all files are LF.
2024-05-08 14:41:19 -04:00
Edu García
f7042717e1 [gl] remove dead code 2024-05-08 18:10:07 +01:00
Edu García
2e59199b24 [gl] extracted some common GPU rendering code 2024-05-08 18:08:19 +01:00
Edu García
d93ca0d5fd [gl] extracted some common GPU rendering code 2024-05-08 18:06:06 +01:00
Edu García
30eef961c5 [gl] Overlay_[type|map] -> gpu_Overlay_[type|map] 2024-05-08 18:04:52 +01:00
Edu García
558b9bb120 [gl] extracted some common GPU rendering code 2024-05-08 18:03:44 +01:00
Edu García
f1941de990 [gl] extracted some common GPU rendering code 2024-05-08 18:01:22 +01:00
Edu García
9b936995ce [gl] Alpha_multiplier -> gpu_Alpha_multiplier 2024-05-08 17:58:59 +01:00
Edu García
7ce523cd5a [gl] extracted some common GPU rendering code 2024-05-08 17:57:06 +01:00
Edu García
ed79ed1672 [gl] extracted some common GPU rendering code 2024-05-08 17:56:00 +01:00
Edu García
061d9ec37b [gl] OpenGL_[state|preferred_state] -> gpu_[state|preferred_state] 2024-05-08 17:49:20 +01:00
Edu García
7c362288ad [gl] extracted some common GPU rendering code (empty impls) 2024-05-08 17:47:21 +01:00
Edu García
9f1b55162d [gl] extracted some common GPU rendering code 2024-05-08 17:40:11 +01:00
Edu García
6705cd9543 [gl] extracted some common GPU rendering code 2024-05-08 17:36:43 +01:00
Edu García
a595fabd03 [gl] OpenGL_Alpha_factor -> gpu_Alpha_factor 2024-05-08 17:31:16 +01:00
Edu García
8aa7a88b9f [gl] remove unused "profiling" code 2024-05-08 17:28:57 +01:00
Edu García
4bd98c16e4 minor refactor of OpenGL renderer 2024-05-08 17:18:21 +01:00
Edu García
a1900bc85b remove unused code (more Software renderer code) 2024-05-08 16:23:12 +01:00
Louis Gombert
9cb68c2e74
Merge pull request #305 from Arcnor/deadcode-removal3
remove unused code (Software renderer, unused macos d3m netgames)
2024-05-08 14:59:52 +02:00
Louis Gombert
fe6bf7bf32
Merge pull request #303 from Arcnor/deadcode-removal2
remove unused code (mainly windows.h)
2024-05-08 14:49:53 +02:00
C.W. Betts
8d3b2f8877
C++ Algorithm pokes (#304)
* Use std::max and std::min, with an initializer_list where possilbe.

* Use std::clamp where appropriate.

* Missed a couple of them.

* Remove clamp specializations at @Lgt2x suggestion.
2024-05-08 11:04:52 +02:00
Edu García
3440667e93 remove unused code (mainly windows.h) 2024-05-07 23:45:33 +01:00
Edu García
aaecc4a5a3 remove unused code (Software renderer, unused macos d3m netgames) 2024-05-07 23:22:05 +01:00
Edu Garcia
553f851714 remove unused code 2024-05-06 22:06:26 +01:00
Ryan C. Gordon
6d837e2083
sdl2: default to fullscreen mode. 2024-05-06 01:43:06 -04:00
Ryan C. Gordon
6f07fd5a94
sdl2: Remove some dead 3DFx Voodoo Linux support code from the year 2000. 2024-05-05 10:25:05 -04:00
Ryan C. Gordon
b362bc9c54
sdl2: Remove a commented out line. 2024-05-05 10:22:16 -04:00
Ryan C. Gordon
f739edff3d
Some more SDL1.2 -> SDL2 work. Mouse input doesn't suck now! 2024-05-02 08:29:23 -04:00
Ryan C. Gordon
001a533399
Initial migration from SDL 1.2 to SDL2. 2024-05-02 08:29:21 -04:00
Ryan C. Gordon
460f401924
Remove renderer/dyna_gl_ryan.h
This is unused code from back when Loki Software was working on the game.
2024-04-30 12:28:35 -04:00
Ryan C. Gordon
6a18afab7c
Remove references to X11 and glX.
This is all in unused/unnecessary/leftover code, but the code wouldn't
build without Xlib headers on the system, which was forcing the Mac builds
to install xquartz.

This also removes renderer/SoftwareOpenGL*, which was _not_ a
software-rendered OpenGL, but just an older version of the same code that's
in HardwareOpenGL.cpp--old enough to still talk to glX directly, which is
what caught my attention.
2024-04-30 12:08:03 -04:00
Ryan C. Gordon
6c8977caf0
Heavy patching for compiler warnings.
The vast majority of this is fixing up `char *` that should be `const char *`
but a handful of other fixes, like potential buffer overflows that GCC
noticed, etc, were applied as well.

This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer
necessary, as there is no longer a flood of compiler warning spam when
building.

This does not fix all compiler warnings; there are still a handful, and they
are legitimate, but they can be dealt with in a future commit.
2024-04-29 00:18:56 -04:00
Jacob Coby
988653e01e Grab mouse after SDL_SetVideoMode
Fixes mouse cursor not being grabbed on macOS. Also sets the
`ddio_mouseGrabbed` flag correctly so it can be detected later on.

Fixes #201
2024-04-28 10:14:26 -04:00
Chris Sarbora
e6ba1906c9
Remove MacOS (Classic) code and all references (1/3)
The MACINTOSH define refers to MacOS Classic (not OS X) which we do not
plan to support. Rather than carry the cruft forever, let's delete it.

NOTE: legacy/ is unused but we're keeping it around, so MACINTOSH uses
there are left alone.

Process used for this commit:
```
git rm -r mac
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" \) \
  -exec unifdef -UMACINTOSH -o {} {} \;
git restore legacy
git add .
```

Test Plan:
On Mac, build both Debug and Release
```
cmake --build --preset mac --config Debug
cmake --build --preset mac --config Release
```
2024-04-27 07:38:14 -07:00
Chris Sarbora
9adfb7ef32
Move old renderer files into legacy/
These files are likely to be useful for future reference.
2024-04-26 15:39:44 -07:00
Ryan C. Gordon
93fdd1ac97
Remove renderer/opengl_ryan.cpp
This was debug/testing code from Loki Software, and is unused.
2024-04-26 09:49:55 -04:00
Thomas Otto
00389c50ea Some more CMake white space formatting
- tabs to spaces
 - use Unix line endings everywhere
 - newline at end of file
 - remove trailing white space
 - no space between keywords and opening parenthesis
 - use 2 spaces to indent
2024-04-21 11:46:32 +02:00
Kevin Bentley
1f45163248 Updated source to reflect the license that this code is released under. 2024-04-20 09:57:49 -06:00
Louis Gombert
c2b71b8147 Standardize CMake formatting
lowercase function names, blocks indent
2024-04-20 14:45:49 +02:00
C.W. Betts
57078ae4b5 Change most sprintf to snprintf.
This also includes vsprintf to vsnprintf.
2024-04-19 12:31:28 -06:00
Thomas Otto
b909a4cf43 Convert min/max macros to std::min/max
Added explicit <float> or <int> template argument where needed.
Add -DNOMINMAX define for Windows.
2024-04-17 21:43:38 +02:00
Jeff Slutter
69a2e15625 Committing local fixes and changes I had. 2024-04-16 22:53:28 -05:00
Azamat H. Hackimov
38128ea134 Additional clang-format 2024-04-17 00:25:04 +03:00
Kevin Bentley
7399b5a2f2 Fix CRLF line endings. 2024-04-16 14:21:35 -06:00
Dan Raviv
e57251a4f4 Restrict i386-only inline assembly 2024-04-16 13:02:45 -07:00
Kevin Bentley
c6640cc631 clang-format on everything. 2024-04-16 12:56:40 -06:00
Kevin Bentley
df209742fc Initial import 2024-04-15 21:43:29 -06:00