Commit graph

101 commits

Author SHA1 Message Date
Zack Middleton
99be1151f7 Fix web client vid_restart with r_mode -2
If getting the display index of the existing window fails, fallback to
the default display size instead of falling back to 640x480.

emscripten r_mode -2 worked on window creation but vid_restart fellback
to 640x480.
2024-06-24 22:38:48 -04:00
Zack Middleton
f41bd37fde Add minimal emscripten support 2024-06-06 20:51:44 -04:00
Zack Middleton
f869bffe97 OpenGL2: Fallback to OpenGL ES if OpenGL fails 2024-06-06 19:49:17 -04:00
Zack Middleton
3b984d2b51 OpenGL2: Add OpenGL ES 2.0+ support
This mainly targets OpenGL ES 2.0 but it also supports compiling GLSL as
ESSL 3.00. It's missing support for framebuffer objects which should be
possible on ES 2. (Though using renderbuffers instead of textures.)

opengl1 cvars that are not supported will display a message and disable
the cvar. This has not been reviewed for new opengl2 cvars. Enabling
cvars may cause rendering issues. Some of the broken cvars may be
possible to support using OpenGL ES 3 features.

The game displays okay with the default cvars.
2024-06-05 21:33:08 -05:00
Thomas Köppe
d1b7ab6b22 [sdl] Turn tentative definition into actual definition.
There is no need for a tentative definition in this case. By providing
an explicit initializer, the resulting definition has the same effect
as before, but is no longer tentative. This avoids easy errors
resulting from multiple tentative definitions in different translation
units. (Previous compilers permitted those common errors, but GCC 10
rejects them by default.)
2020-11-17 18:08:13 +00:00
Zack Middleton
350b8f9c7c Restore OpenGL 1.1 support (GL_CLAMP)
GL_CLAMP (clamp to border) was changed to GL_CLAMP_TO_EDGE in 2008
(f2baf359). In 2018 (ce1d5406) I made OpenGL 1.2 be required since
GL_CLAMP_TO_EDGE is used.

Restore support for GL_CLAMP in order to support OpenGL 1.1 like vanilla
Quake 3 does. This should allow using the default Microsoft Windows
GDI Generic OpenGL 1.1 driver (untested but it won't fail the version
check at least).

From gpuinfo.org, it looks like drivers stopped advertising support for
GL_SGIS_texture_edge_clamp so use a version check in addition to the
extension check.

r_allowExtensions 0 disables using GL_CLAMP_TO_EDGE in the opengl1
renderer. GL_CLAMP support wasn't added to the opengl2 renderer.
2019-05-28 22:44:57 -05:00
Zack Middleton
0fbde293db Remove erroneous newlines from Com_Error in sdl_glimp.c 2019-05-28 21:01:28 -05:00
Zack Middleton
658165cfbb Don't check fixed function GL extensions when using shader pipeline
GL_TEXTURE_UNITS_ARB is not part of OpenGL ES 2 API and sets GL error.
It's not part of OpenGL 3.2 core profile either.
2018-07-20 23:40:26 -05:00
Zack Middleton
d861a4f427 Load OpenGL ES 2.0 function procs
Load functions procs supported by OpenGL ES 2.0, though there is not a
compatible renderer yet. Change argument for GLimp_Init from coreContext
to fixedFunction.
2018-07-20 23:40:21 -05:00
Zack Middleton
7391215bd4 Don't load non-core GL functions for OpenGL 3.2 core context
Also declare the GL functions in tr_local.h so there is compile error
for non-core GL functions instead of SEGFAULT from dereferencing a NULL
pointer.

Disable the non-functional stencil shadow code that hasn't been updated
to use OpenGL 3.2 core compatible drawing.
2018-07-20 23:40:17 -05:00
Zack Middleton
bead4aa8c7 Fix renderer not clearing some GL extension variables at vid_restart
If renderer is compiled into client (USE_RENDERER_DLOPEN=0) and after
start up set r_allowExtension to 0 and run vid_restart, some extension
were still used.
2018-07-20 23:40:02 -05:00
Zack Middleton
ce1d5406d5 Require OpenGL 1.2 for GL_CLAMP_TO_EDGE 2018-05-28 17:20:27 -05:00
Zack Middleton
77de5019b9 Don't create multiple windows when GL context creation fails 2018-05-28 17:07:38 -05:00
Zack Middleton
7e9b92de12 Fix displayed color/depth/stencil bits values
The values passed to SDL are just the minimum required. Get actually
values of colorbits, depthbits, and stencilbits from SDL instead of
assuming that the engine got exactly what it asked for.
2018-04-11 01:26:00 -05:00
Zack Middleton
a83ae01d93 Load OpenGL ES 1.1 function procs 2017-10-02 04:48:07 -05:00
Zack Middleton
da07a6dbd9 Support parsing OpenGL ES version strings
The renderers don't support OpenGL ES though.
2017-10-01 23:09:20 -05:00
Zack Middleton
c9d12aa3f3 Add common OpenGL version parsing + OpenGL 3 fixes
- Parse OpenGL version in sdl_glimp.c to share with both renderers.
- Add GL_VERSION_ATLEAST(major, minor) macro.
- Get address of glGetStringi if using OpenGL 3.
- Fix glConfig.extensions_string when using GL3 core context in
opengl2 renderer.
- Make opengl1 renderer's gfxinfo support qglGetStringi too.
2017-10-01 23:09:20 -05:00
Zack Middleton
20573bce43 Don't link to libGL at compile time
Get all OpenGL functions using SDL_GL_GetProcAddress(). This makes it
easier to cross-arch compile on Linux and add support for OpenGL ES
in the future.

Users still have to supply their own libSDL2 for cross-arch compiling
on Linux. But now the user does not have to re-install libgl1-mesa-dev
package for i386 or amd64 on Debian when switching between compiling
ioquake3 for x86 and x86_64.
2017-10-01 23:07:33 -05:00
SmileTheory
2955f8dadb Reject OpenGL contexts w/ software renderer when core context requested. 2017-08-03 14:20:33 -07:00
SmileTheory
d549b642bc OpenGL2: Use an OpenGL 3.2 core context if available. 2017-07-13 12:03:10 -07:00
Wolf
6b514ee532 Correct test for GL_EXT_texture_env_add support
The test string is missing the initial "GL_" so it is always failing the test even when supported on newer hardware.
2017-01-26 00:14:31 -08:00
SmileTheory
06b47ad2a9 GLimp_HaveExtension() -> SDL_GL_ExtensionSupported() 2016-12-10 00:35:17 -08:00
Tim Angus
db941dcb5f Merge pull request #138 from Pan7/SDL_Swap
SDL_GL_SetSwapInterval() check
2015-07-26 19:49:49 +01:00
Tim Angus
793708a010 Merge pull request #137 from Pan7/SDL_display
SDL_GetWindowDisplayIndex() check2
2015-07-26 19:49:04 +01:00
Pan7
525eac0d99 SDL_GL_SetSwapInterval() check 2015-07-26 20:23:48 +02:00
Pan7
56808ab51f SDL_GetWindowDisplayIndex() check2 2015-07-26 19:46:07 +02:00
Tim Angus
c35e0faffb Merge pull request #136 from Pan7/SDL_NULL
SDL_CreateWindow NULL check
2015-07-26 15:50:54 +01:00
Pan7
4b176297e2 Added SDL_GetError() 2015-07-26 15:41:41 +02:00
Pan7
6fb47ce9bf SDL_CreateWindow NULL check 2015-07-26 13:54:29 +02:00
Pan7
9694e93fd2 SDL_GetWindowDisplayIndex check 2015-07-26 13:03:47 +02:00
Tim Angus
605dfabb94 Merge pull request #132 from Pan7/SDL_Init
SDL_Init zero check
2015-07-25 11:54:12 +01:00
Pan7
2a38bca931 SDL_Init zero check 2015-07-24 22:56:00 +02:00
Zack Middleton
da8a74d734 Fix variable declaration for C89 compilers 2015-06-28 16:29:10 -05:00
Tim Angus
61825d8e5f Check SDL_GetNumDisplayModes return value for errors 2015-06-28 18:01:03 +01:00
Zack Middleton
e5af084211 Remove erroneous new line from error message 2015-06-12 13:08:10 -05:00
Simon McVittie
df7dab721f Don't crash if more than 128 modes are available 2015-01-07 23:39:12 +00:00
Zack Middleton
1d016e6ff5 Clear window buffer when it's created
When starting the game in windowed mode, the window buffer used whatever
was on the screen before running the game. Kind of like you could see
through the window, but it doesn't update what happens behind it.

It makes it look like something is broken or non-responsive.

So clear the window opengl buffer to black.

Credit to theinvsblman for the code.
2014-11-07 21:50:00 -06:00
Zack Middleton
24923615b7 Don't add duplicate resolutions to r_availableModes
SDL can give the same resolution with different refresh rates.
The refresh rate isn't used, so only add resolution to mode list once.
2014-09-20 19:23:33 -05:00
Zack Middleton
344ff23164 Fix multisampling on X11
Setting SDL_GL_ACCELERATED_VISUAL was disabled for ioq3 SDL 1.2
for other reasons. However, it causes creating GL context to fail
if multisampling is enabled on X11 for both SDL1.2 and SDL2.

Tested using nVidia proprietary driver on Debian 7.
2014-03-17 12:24:59 -05:00
Zack Middleton
8455b5a833 Don't crash when fail to create SDL window 2014-03-15 17:54:00 -05:00
Zack Middleton
ed087bb89e Merge branch 'master' into sdl2 2014-02-07 23:24:12 -06:00
Zack Middleton
7c0491d7fd Add latch to r_centerWindow and r_allowResize 2013-12-06 23:42:23 -06:00
Zack Middleton
8c1d3c635c Use bundle icon on Mac OS X instead of internal 32x32 window icon 2013-10-19 01:54:58 -05:00
cmf028
d7444b8ca1 Don't set the window title twice 2013-09-23 12:21:20 -05:00
Tim Angus
58b8cfa0b3 Various fixes from Fuma 2013-09-15 23:54:52 +01:00
Tim Angus
fb9270306b Fix initial window position being top left 2013-08-29 19:15:35 +01:00
Tim Angus
bde7665462 Merge branch 'master' into sdl2
Conflicts:
	code/sdl/sdl_input.c
2013-08-16 23:34:08 +01:00
Zack Middleton
81909bb266 Fix text getting appended to vid_restart in command buffer
I was getting unknown command "vid_restart-button2" warning on OSX when trying to use alt-return to toggle fullscreen.
2013-08-03 17:40:50 -05:00
Tim Angus
d9d52f0306 Merge branch 'master' into sdl2
Conflicts:
	Makefile
	code/renderercommon/qgl.h
	code/renderergl1/tr_local.h
	code/sdl/sdl_glimp.c
2013-05-08 14:27:15 +01:00
Tim Angus
2da0fd6de8 Add renderercommon/tr_common.h 2013-02-16 20:58:04 +00:00