Commit Graph

82 Commits

Author SHA1 Message Date
Chris Sarbora
46043e709d use GL_RGBA8 instead of invalid GL_RGB 2024-08-18 03:26:07 -05:00
Chris Sarbora
38100b8ed1 use GL_CLAMP_TO_EDGE instead of deprecated GL_CLAMP 2024-08-18 03:26:07 -05:00
Chris Sarbora
77fb0cd1ab use GL_TRIANGLE_FAN instead of nonexistent GL_POLYGONS 2024-08-18 03:26:06 -05:00
Chris Sarbora
a06e78074f remove EXT and ARB suffixes 2024-08-18 03:26:06 -05:00
Chris Sarbora
791cdcb308 eliminate hints to things the shader does now 2024-08-18 03:26:06 -05:00
Chris Sarbora
256898dfc6 Move fog into shader 2024-08-18 03:26:06 -05:00
Chris Sarbora
625b2fc1a1 update vertices modernly 2024-08-18 03:26:06 -05:00
Chris Sarbora
0dd203e2c0 create, track, and clean up texture ids responsibly 2024-08-18 03:26:06 -05:00
Chris Sarbora
a5081982f6 Always use Multitexture 2024-08-18 03:26:06 -05:00
Chris Sarbora
d25bf5e4e1 set up texture enabling
eliminate gl(Enable|Disable)ClientState and glClientActiveTextureARB
2024-08-18 03:26:06 -05:00
Chris Sarbora
5b4703bf5f pipe color and texcoords thru the shaders 2024-08-18 03:26:06 -05:00
Chris Sarbora
16df2d764a Set up transformations in vertex shader 2024-08-18 03:26:03 -05:00
Chris Sarbora
d61deae68d add rudimentary shaders and machinery 2024-08-18 02:52:46 -05:00
Chris Sarbora
bc99cc867b use opengl 3.2 2024-08-18 02:52:46 -05:00
Chris Sarbora
9950c80e64 eliminate glBegin usage 2024-08-18 02:49:07 -05:00
Chris Sarbora
f8043c1390 extract DetermineColor logic 2024-08-18 02:49:07 -05:00
Chris Sarbora
18ccdf5a81 glShadeModel calls are redundant with default setting, rend_SetLightingState is redundant with rend_SetLighting 2024-08-18 02:49:07 -05:00
Chris Sarbora
8d94450b7a dglAlphaFunc(GL_GREATER, 0) is perfectly redundant 2024-08-18 02:49:07 -05:00
Chris Sarbora
e152b5df70 setting depth range to [0, 1] is superfluous 2024-08-18 02:49:07 -05:00
Chris Sarbora
fb2dbe8c92 Delete empty method 2024-08-18 02:49:07 -05:00
Chris Sarbora
8d26df7b25 Delete written-only fields 2024-08-18 02:49:07 -05:00
Chris Sarbora
201d4add62 Make dyna_gl definitions easier and own all fn lookups 2024-08-18 02:49:06 -05:00
Chris Sarbora
bd06bf5288 rename ogl* to dgl* 2024-08-18 02:49:06 -05:00
Louis Gombert
1328a8c846 Remove non-functional OpenGL logging methods 2024-07-28 17:52:01 +02: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
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
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
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
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
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
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 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