Commit graph

272 commits

Author SHA1 Message Date
SmileTheory
f965f3c66e OpenGL2: DDS (compressed textures) support. 2015-12-18 06:53:20 -08:00
SmileTheory
336419235a OpenGL2: Some tr_image.c cleanup. 2015-12-16 07:12:30 -08:00
SmileTheory
cbfc3471bc OpenGL2: Switch to RGTC from LATC for normal maps.
Also added a RGTC compressor as a workaround on Intel graphics.
2015-12-15 03:23:55 -08:00
SmileTheory
c07cc282d0 OpenGL2: Use correct sunlight color for sunlight specular. 2015-12-09 05:25:58 -08:00
SmileTheory
08ecc3a80a OpenGL2: Forgot a multiply. 2015-12-09 03:42:12 -08:00
SmileTheory
f9c72eee69 OpenGL2: Parse radius entries from misc_cubemap entities. 2015-12-09 02:00:40 -08:00
SmileTheory
b52ede0445 OpenGL2: Add r_glossIsRoughness. 2015-12-08 21:23:50 -08:00
SmileTheory
92d4b20129 OpenGL2: Add option in code for alternate overbright method. 2015-12-08 05:17:05 -08:00
SmileTheory
e5aabdaff6 OpenGL2: Remove some rendering options for simplicity. 2015-12-03 02:44:33 -08:00
SmileTheory
2954bdfa65 OpenGL2: automatically load textures with a _s suffix as specular. 2015-12-02 17:08:40 -08:00
Zack Middleton
41f83ac8b0 Replace 4 with sizeof( int ) in R_GetCommandBufferReserved 2015-10-17 21:58:11 -05:00
Zack Middleton
81e2b6c0cf Fix reserved size for swap buffer command being too small on x86_64 2015-10-16 20:50:25 -05:00
Zack Middleton
e6209f3b7c Fix crash from reading past end of tr.refdef.drawSurfs
The number of draw surfaces was range checked against number of surfaces for
the current view but needs to check total for the frame otherwise can read
past the end of the tr.refdef.drawSurfs array when there are multiple views.
2015-10-16 20:21:15 -05:00
Zack Middleton
8531162bd9 Fix not swapping buffers because out of cmd buffer space
Reserve space for end of list and swap buffer commands. These are absolutely
required and cannot be dropped. Dropping swap buffer command causes screen
to not update and possible crash from drawsurf buffer overflow if not enough
cmd buffer space for many continous frames.
2015-10-16 19:38:49 -05:00
Zack Middleton
7f4b34bf09 Remove unused define MAC_EVENT_PUMP_MSEC 2015-10-04 17:20:56 -05:00
Zack Middleton
a5fbc1bfc4 Fix alloc size for default skin and single shader skin
Found by Coverity.
2015-07-12 20:41:47 -05:00
Zack Middleton
4473924636 Remove logically dead code in R_CheckFBO
Found by Coverity.
2015-07-12 20:35:22 -05:00
Zack Middleton
9f57fea0ee Backport ignoring values outside lightgrid to OpenGL1
Fixes possibly of reading memory past end of lightGridData or reading
wrong light grid data (wrapping around to next row).
2015-07-12 18:17:57 -05:00
Zack Middleton
1bb2bc370d Fix OpenGL2 ignoring last light grid point on each axis
Also change light grid bounds clamping to make it more clear what invalid
values are.
2015-07-09 22:42:01 -05:00
Zack Middleton
b152cf1423 Don't fog 3D crosshair sprite 2015-07-04 19:33:28 -05:00
Zack Middleton
5e575ae82e Apply greyscaling to fog blocks 2015-07-04 19:17:58 -05:00
Zack Middleton
f110f668bf Move image load function prototypes to tr_common.h
The functions themselves are in code/renderercommon/tr_image_*.c
2015-06-12 14:22:37 -05:00
SmileTheory
3ebc230b28 OpenGL2: Use signed value in case value goes below 0. 2015-04-06 03:05:28 -07:00
Zack Middleton
c755d75a5e Fix MDR surface indexes overflow check
Also, use the check overflow macro like everywhere else.
2015-03-25 15:41:03 -05:00
Zack Middleton
1a7628126a OpenGL2: Fix shadow cubemap segfault
Changed image size to 512, but 'data' buffer is only 16x16 resulting
in libGL segfault. Use NULL instead like other dynamic images.
2015-03-24 03:39:53 -05:00
Author: Xycaleth
33efe82de9 OpenGL2: Fix shadow cubemap size 2015-03-23 20:05:35 -05:00
SmileTheory
40cfbc9a82 OpenGL2: Fix culling again. 2015-03-12 21:44:06 -07:00
Zack Middleton
99b74fc5bf OpenGL2: Remove unused function prototype from tr_fbo.c 2015-02-07 18:52:03 -06:00
Ensiform
43c7f1e734 Inform how many shader stages the max is in the warning message 2015-01-26 02:39:59 -06:00
SmileTheory
8c7fedb1fe OpenGL2: Fix face culling. 2014-11-30 21:50:33 -08:00
SmileTheory
fd23249357 OpenGL2: Ensure tess VAO is bound before using it. 2014-11-21 16:12:53 -08:00
Zack Middleton
c787cf3aef Fix stencil shadows not drawing if has 500 or more vertexes
Stencil shadow is not drawn if a mesh, or multiple meshes with the same
entity and shader, have more than 500 vertexes. The issue is caused by storing
the projected positions in the tess vertex buffer. Use a new array instead.
2014-11-16 21:21:30 -06:00
Zack Middleton
d06deb41c8 Don't set fog image border color
GL1's R_CreateImage sets GL texture to 0 before it ends, so border color is not
applied to the fog image. GL_CLAMP is not used for fog image (in either renderer),
so it would presumably not be used even if applied to the fog image.
2014-11-16 14:59:09 -06:00
Zack Middleton
60d28722ef Remove unfinished OpenGL display list code
It seems unlikely anyone is going to do anything with this aside from stub
it out in OpenGLES ports.
2014-11-16 14:57:13 -06:00
Zack Middleton
22bcda018b Correct a few OpenGL variable types
Affectly no change for desktop OpenGL.
Use correct types for OpenGLES support.
2014-11-16 14:56:43 -06:00
SmileTheory
89b719ec8d OpenGL2: Bit more parallax optimization. 2014-11-14 01:12:41 -08:00
SmileTheory
d9e2184c1a OpenGL2: Add support for parallax occlusion mapping. 2014-11-10 22:11:36 -08:00
SmileTheory
b1821e303d OpenGL2: remove lightmap support from generic glsl shader.
This path was barely used and doing this compiles fewer shaders.
2014-11-10 21:59:37 -08:00
SmileTheory
1ad2b413ef Remove accidentally added increment. 2014-11-03 22:18:17 -08:00
SmileTheory
943259f6b4 OpenGL2: Support half floats for texcoords and vertex colors. 2014-11-03 19:10:35 -08:00
Zack Middleton
1ba9e7a45e Always use GL_Cull to change cull state
Manually changing cull state can cause later GL_Cull calls to not change
the cull state.
2014-10-29 01:32:50 -05:00
SmileTheory
e488663e31 OpenGL2: Change normal/tangent vertex encoding. 2014-10-28 18:15:13 -07:00
SmileTheory
7e808f92d6 OpenGL2: Speed up tonemap shader. 2014-10-27 06:37:57 -07:00
SmileTheory
3765652778 OpenGL2: Fix corrupt models. 2014-10-23 16:51:10 -07:00
SmileTheory
4f5ebf8349 OpenGL2: Bit of multidraw optimization. 2014-10-16 00:32:20 -07:00
SmileTheory
03ac9649ea Fix a bug in previous commit. 2014-10-15 20:28:26 -07:00
SmileTheory
e34972b110 OpenGL2: Fix missing surfaces with r_mergeMultidraws 2. 2014-10-15 20:00:54 -07:00
SmileTheory
541d3a40c2 OpenGL2: Interleave vertex data for static MD3s. 2014-10-15 03:42:29 -07:00
SmileTheory
05e07311ba OpenGL2: Fix invalid texture parameter. 2014-10-15 03:40:16 -07:00
SmileTheory
0578b70f38 OpenGL2: Reduce redundant GL calls. 2014-10-14 06:15:06 -07: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
Zack Middleton
918eed9295 OpenGL2: Don't segfault if r_ext_multitexture is disabled 2014-09-29 01:02:13 -05:00
Zack Middleton
a955d975b7 Add function for clearing global shader instead of duplicating the code 2014-09-27 01:35:35 -05:00
Zack Middleton
4529f124d6 Merge pull request #29 from inolen/shader_tidying
misc shader fixes
2014-09-09 19:18:59 -05: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
c621589157 Fix 6155: OpenGL2: some shader stages remains visible through fog volumes
Fix CalcFog in generic_vp.glsl to fog fogged surfaces.
Now it's the same as CalcFog in fogpass_vp.glsl.

Fixes shaders that use adjustColorsForFog. Impact wallmarks, blood sprites, flame textures and so on.
2014-08-29 02:50:02 -05:00
Zack Middleton
e742952db8 Port COM_ParseExt fixes to CommaParse 2014-08-28 20:34:05 -05: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
Zack Middleton
e5f54c584a Fix incorrect rgbGen const reading uninitialized memory
If ParseVector fails, color isn't fully set.
2014-08-27 20:35:16 -05:00
Tim Angus
cf7004ffb2 Fix OSX build 2014-08-25 12:03:10 -04:00
Tim Angus
2a3368481d Merge branch 'master' into sdl2
Conflicts:
	Makefile
	code/renderergl2/tr_image.c
2014-08-25 15:00:48 +01:00
Tim Angus
7d026177ad Fix assorted warnings 2014-08-25 14:48:49 +01:00
SmileTheory
ca9eebb125 OpenGL2: Fix a glsl compile error on old hardware with r_shadowFilter 0. 2014-08-02 00:02:46 -07:00
SmileTheory
ff1f093a0b OpenGL2: Remove R_MipMap() and R_MipMap2(), and fix gamma conversion in R_MipMapsRGB() 2014-08-01 23:57:26 -07:00
SmileTheory
2b2d696f12 OpenGL2: Add fourth cascade for sun shadows, and adjust sun shadow cvar defaults. 2014-07-31 21:01:57 -07:00
Zack Middleton
75cce50a9c Don't load external GLSL files by default
External GLSL should probably only be used for development testing,
not released products. The GLSL files are tied to the code, and the
code changes some what often.

Fixes using OpenArena 0.8.8 which has incompatible GLSL files in a pk3.
2014-07-25 23:57:53 -05:00
SmileTheory
3d01543e2c OpenGL2: Replace R_MipMapsRGB() with faster version. 2014-07-22 11:43:19 -07:00
Zack Middleton
95b241b8ba OpenGL2 don't try to dlight surfaces that had all dlights culled
In the renderers, dlightbits are never cleared from world surfaces.
The dlight image does not repeat, so if it draws on extra surfaces it's
not visible.

However if using a repeating image (tr.defaultImage instead of tr.dlightImage);

  * In OpenGL1 image is only drawn on surfaces close to dlight origin.
  * In OpenGL2 image is draw on surfaces clearly outside the dlight radius, including past non-dlighted surfaces.

It seems there was a similar issue with pshadowBits. So update surface
dlightBits even if 0, like already done for pshadowBits. This causes
only surfaces close to origin to be affected. (Though it is a little
farther than in OpenGL1.)

I have no idea why this isn't a problem in OpenGL1.
2014-06-10 21:34:31 -05:00
Zack Middleton
107cae63d6 Merge branch 'master' into sdl2
Conflicts:
	.travis.yml
2014-06-03 00:52:49 -05:00
Zack Middleton
b12a9acf4d Merge branch 'master' (early part 2) into sdl2 2014-06-03 00:50:50 -05:00
SmileTheory
9efaf819dc OpenGL2: Really obvious optimization to previous commit. 2014-05-27 20:52:36 -07:00
SmileTheory
318d45cff5 OpenGL2: Reimplement MD3 tangent space calculation. 2014-05-27 18:20:12 -07:00
Zack Middleton
eeeaf3f125 Fix potential buffer overflow caused by long tcMod args
Found by Coverity.
2014-05-25 18:44:17 -05:00
Zack Middleton
9c99cf29db Have OpenGL2 "map $lightmap" check for NULL tr.lightmaps too
Zero length lightmap lump will have NULL tr.lightmaps.

OpenGL1 already has this check, because r_vertexLight 1
would crash Team Arena. OpenGL2 does not disable loading lightmaps
when r_vertexLight is 1 though, so it does not have that issue.
2014-05-25 18:41:57 -05:00
Zack Middleton
e21ff01946 Don't use memset with non-zero value to fill ints
Coverity reported using value -2 as a bad memset. Really doesn't make sense when filling ints and not bytes too.
2014-05-25 16:10:01 -05:00
Zack Middleton
3a7298d6ae Make R_LerpTag return qfalse if MDR tag does not exist
Elite Force SDK has trap_R_LerpTag return void, so this shouldn't cause issues for iostvef.
Allows new games to check if a tag exists in a MDR model.
2014-05-06 21:10:16 -05:00
SmileTheory
4fe69cb418 OpenGL2: Remove sRGB support, replace with gamma cvars. 2014-04-16 05:26:03 -07:00
Zack Middleton
c55df2c9aa Merge branch 'master' into sdl2 2014-03-24 17:53:08 -05:00
Zack Middleton
73aa7ef2c7 Merge branch 'master' (early part) into sdl2 2014-03-24 17:51:57 -05:00
Zack Middleton
9f3fd12501 Remove unused extern qboolean charSet
No variable even exists.
2014-03-24 12:47:14 -05:00
SmileTheory
b099255748 #6095: OpenGL2: Use areamask and leaf cluster for PVS when VIS is missing. 2014-03-19 17:59:07 -07:00
SmileTheory
375f6247d4 OpenGL2: Parallax corrected cubemap (cheaper trick) 2014-03-16 16:29:38 -07:00
Zack Middleton
07290a7d52 Fix typo in animMap and videoMap warnings 2014-03-10 19:58:55 -05: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
5a3e10d716 Don't say cubemap is outside lightgrid 6 times 2014-03-10 16:12:49 -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
9ec7931c54 Merge branch 'master' into sdl2 2014-03-08 21:32:47 -06: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
MAN-AT-ARMS
11ed883298 OpenGL2: Set default normal/specular in RE_RegisterShaderFromImage 2014-03-04 20:31:31 -05:00
SmileTheory
ee67d0a981 OpenGL2: Add normalScale and parallaxDepth stage keywords and helper cvars. 2014-03-03 21:02:39 -08:00
SmileTheory
ea2810c085 OpenGL2: Minor GLSL shader improvements. 2014-03-03 17:32:07 -08:00
MAN-AT-ARMS
71386beaac OpenGL2: Fix pshadows for MDR models 2014-02-22 18:09:48 -06:00
SmileTheory
3740c55dec OpenGL2: Remove and force r_softOverbright. 2014-02-20 17:01:50 -08:00
Tim Angus
1250b352be Merge branch 'master' into sdl2 2014-02-18 10:30:35 +00: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