Commit Graph

64 Commits

Author SHA1 Message Date
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
Zack Middleton eaefa35580 OpenGL2: Fix merged lightmap hacks to have real lightmap index
This fixes the texcoord range to be 0.0 to 1.0 for external lightmaps in
shaders that also have an internal lightmap. (Instead of 2.0 to 3.0 for
example.) This only affects clampMap as repeating wrapping sampled the
correct location. I haven't found such a shader but I need to get real
lightmap index for future merged lightmap hacks.
2024-02-10 16:23:54 -05:00
Zack Middleton ae0878ca61 OpenGL2: Fix q3map2 lightstyles effects
Fixes World of Padman wop_trashmap.

For r_mergeLightmaps 1
- Fix tcMod transform on "map $lightmap" stages
- Fix external lightmap image texcoords if shader also has an internal
  lightmap

For r_sunlightMode 1
- Fix "tcGen lightmap" stages with blendFunc GL_SRC_ALPHA GL_ONE being
  converted to white image + modulate lightmap and drawing incorrectly
2023-12-23 14:31:47 -05:00
Edward Betts fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
SmileTheory c65d2c2657 Add vao cache for static surfaces.
Remove support for draw range elements, multi draw arrays, world vao creation, surface merging.
2017-04-28 02:13:25 -07:00
SmileTheory 41ae7815c9 OpenGL2: Remove half float support.
Not enough accuracy for textures larger than 1024x1024, such as merged lightmaps.
2016-10-20 20:09:12 -07:00
SmileTheory 863adfcfc2 OpenGL2: Fix fog color. 2016-10-12 23:17:19 -07:00
SmileTheory aa79738c50 OpenGL2: Store vertex colors and hdr lightmaps/lightgrid as RGBA16. 2016-10-11 03:28:20 -07:00
SmileTheory 239f539702 OpenGL2: Non-square merged lightmaps. 2016-10-10 03:06:03 -07:00
SmileTheory 8749d62bbd OpenGL2: Remove per fragment tangent space calculation code. 2016-09-14 03:57:51 -07:00
SmileTheory 4faf1008a0 OpenGL2: Remove map color scaling and r_forceSunMapLightScale.
Also simplify overbright code in ComputeShaderColors().
2016-09-14 02:59:54 -07:00
SmileTheory f9e5712311 OpenGL2: Fix missing bounds calculation when loading BSP surfaces. 2016-09-06 19:44:14 -07:00
SmileTheory dfbaf50324 OpenGL2: Store normals/tangents as int16_t[4]. 2016-09-06 00:57:15 -07:00
SmileTheory 4ce600f5ac Missing bit of previous commit. 2016-08-14 22:33:48 -07:00
SmileTheory fe8ac838e2 OpenGL2: Preallocate grid surfaces like other BSP surfaces. 2016-08-14 22:22:20 -07:00
SmileTheory 716438168f OpenGL2: Use loader for all extension funcs. 2016-07-26 00:41:31 -07:00
SmileTheory 6394180224 OpenGL2: Speed up surface merging. 2016-05-18 21:12:34 -07:00
SmileTheory 0f6f2be155 OpenGL2: Typos. 2016-02-12 18:34:31 -08:00
SmileTheory 871872689e OpenGL2: Add named cubemaps and per-map env.json parsing. 2016-02-10 16:25:32 -08:00
SmileTheory ad952b9537 OpenGL2: Merge several cvars into r_pbr.
r_glossIsRoughness, r_specularIsMetallic, r_framebufferGamma, r_tonemapGamma, r_materialGamma, r_lightGamma
2016-02-01 21:37:23 -08:00
SmileTheory 2b2f1aeaa1 OpenGL2: Load existing per-map cubemaps. 2016-01-28 16:39:42 -08:00
SmileTheory e2b2437966 OpenGL2: Add r_cubemapSize. 2015-12-24 16:34:58 -08:00
SmileTheory c3216f54d2 OpenGL2: Replace r_exportCubemaps cvar with exportCubemaps command. 2015-12-23 09:58:11 -08:00
SmileTheory a6a6162f04 OpenGL2: Add r_exportCubemaps for saving cubemaps on map load. 2015-12-22 05:04:07 -08:00
SmileTheory f9c72eee69 OpenGL2: Parse radius entries from misc_cubemap entities. 2015-12-09 02:00:40 -08:00
SmileTheory 92d4b20129 OpenGL2: Add option in code for alternate overbright method. 2015-12-08 05:17:05 -08:00
SmileTheory 84206c8598 OpenGL2: Vertex array object support. 2014-10-14 01:50:44 -07:00
SmileTheory 873a02bd3c OpenGL2: VBO cleanup. 2014-10-13 21:57:06 -07:00
SmileTheory a90c17ac1b OpenGL2: Better BSP surface merging. 2014-10-07 04:17:01 -07:00
Tim Angus 7277d8d6e7 Fix more warnings 2014-09-01 13:03:06 +01:00
Tim Angus 6665ea4a49 Fix renderergl2 warnings 2014-09-01 11:35:49 +01:00
Zack Middleton f17f58705c Remove a numIboIndexes=0 that is not read from GL2 tr_bsp.c
numIboIndexes is set to 0 inside the loop for each surface. Does not need to be set before loop.
2014-08-27 20:47:45 -05:00
SmileTheory 2b2d696f12 OpenGL2: Add fourth cascade for sun shadows, and adjust sun shadow cvar defaults. 2014-07-31 21:01:57 -07:00
SmileTheory b099255748 #6095: OpenGL2: Use areamask and leaf cluster for PVS when VIS is missing. 2014-03-19 17:59:07 -07:00
Zack Middleton c8c7bb1dc3 Fix R_GetEntityToken ending prematurely
If spawn var key or value is "" it caused R_GetEntityToken (available to
cgame, used by opengl2) to stop parsing, whereas game VM would continue.

Changed it to match parsing used for game VM
(see G_GET_ENTITY_TOKEN in code/server/sv_game.c).

The map poq3dm5 has a "wait" key with value "".
2014-03-10 16:27:31 -05:00
Zack Middleton b98e6d5cc0 Fix error handling in R_ParseSpawnVars
When R_GetEntityToken returns qfalse it resets pointer for parsing, by
R_ParseSpawnVars not returning qfalse it could cause an infinite loop.

Also add newlines to printfs.
2014-03-10 15:57:26 -05:00
Zack Middleton e7f43545ed Don't wash out HDR vertex lite surfaces in OpenGL2
Vertex lite surfaces being brighter than light maps looks bad,
they're meant to look the same. Especially in ET, which mixes
them fequently. It's noticeable in Q3 too though.

BSP lightmaps (i.e. not external HDR lightmaps) use
R_ColorShiftLightingBytes, now *Floats (used by vertex colors)
has the same behavior.

This may be a problem for HDR lightmaps, as the RGB will always be
scaled to 0.0 to 1.0 range.

I had enabled this for non-HDR before, but now HDR needs it too.
2014-03-08 12:30:47 -06:00
SmileTheory 5fabc28dff OpenGL2: Fix rendering when r_hdr = 0 and r_floatLightmap = 1 2014-02-14 22:41:25 -08:00
SmileTheory 78f8100d74 OpenGL2: Oops, set lightmap alpha to 1. 2014-02-14 03:31:54 -08:00
SmileTheory 7a23bb1c59 OpenGL2: Fix bug in ColorToRGBM(). 2014-02-14 02:52:22 -08:00
SmileTheory 79e9baedf8 OpenGL2: Set RGBM to use a multiplier of 1, and only use it with HDR lightmaps. 2014-02-13 18:04:23 -08:00
Zack Middleton dde36d91ce Fix OpenGL2 non-HDR map surface over brighting
Vertex lit map surfaces were saturating to white when
r_mapOverBrightBits was increased and r_hdr was disabled.

Now the color is normalized like lightmaps and lightgrid
when r_hdr is disabled. Which is the same as OpenGL1.

Noticeable on misc_model trisoup.
2014-01-16 00:12:21 -06:00
Zack Middleton 581b6316b7 Fix GL2 deluxemap 0,0,0 to 127,127,127
Checked if first byte was 0 twice instead of checking second byte.
2014-01-12 17:02:21 -06:00
SmileTheory 6e5f8cc918 OpenGL2: Calculate bitangent in shader, and store normal/tangent as normalized byte arrays. 2013-11-12 19:21:51 -08:00
Zack Middleton a53e7c3074 Fix comparing unsigned values to < 0 in gl2 2013-11-11 01:12:42 -06:00
SmileTheory ef9fe17dd5 OpenGL2: Remove srfTriangle_t, and use glIndex_t instead. 2013-11-08 01:46:17 -08:00
SmileTheory d295db747c OpenGL2: Small optimizations and comments in world VBO creation and surface merging. 2013-11-07 04:03:52 -08:00
SmileTheory 7672533e8f OpenGL2: Prefer VBO/IBO sizes of around 4MB. 2013-11-05 20:07:10 -08:00
SmileTheory 535d0ea70e OpenGL2: Merge bsp surface structs into a single struct, and more cleanup. 2013-10-15 01:19:16 -07:00
SmileTheory 01efe4a538 OpenGL2: Use an idea from ETXreal and separate world VBO into separate VBOs by shader. 2013-10-14 03:58:13 -07:00