Commit graph

102 commits

Author SHA1 Message Date
Dominic Fandrey
a740ba47dd OpenGL1: Decay float[8] to float * in tr_marks.c 2018-04-08 21:41:31 -05:00
Zack Middleton
b48d902672 OpenGL1: Use glGenTextures instead of hardcoded values
It's the proper way to use the OpenGL API. It's already done in the
OpenGL2 renderer.
2018-03-13 09:17:23 -05:00
Thomas Köppe
917bca4f7d Use standard offsetof facility. Dereferencing a null pointer results
in undefined behaviour.
2018-01-21 06:01:50 -06:00
Edward Betts
fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
Zack Middleton
9e502bda4d Only draw cm_patch/bot debug polygons in world scenes
Fixes debug polygons appearing in HUD head model scene.
2017-10-08 07:18:40 -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
6f0736ce9a Fix loading renderer DLLs on Windows x86
After 'Fix floating point precision loss in renderer', Windows x86
client won't load the renderer DLLs. The problem is a 64 bit modulus.
I couldn't find any reports of this online. However, client with
built-in renderer worked with the 64 bit modulus.

Only tested with mingw-w64.
2017-09-07 20:42:31 -05:00
Zack Middleton
59b1262b82 Fix floating point precision loss in renderer [part 2]
Fix floatTime using float precision instead of double using GCC.
Fix R_BindAnimatedImage to be in sync with function table.
Fix vertexDeform bulge, vertexDeform normals, noise wave function
at high level time.

Revert unnecessary float -> double conversions.
2017-08-03 00:14:22 -05:00
Zack Middleton
30fdd88c9f Fix floating point precision loss in renderer [part 1]
Patch for https://bugzilla.icculus.org/show_bug.cgi?id=5931 by
Eugene C. from 2013 plus recent fix for tcMod rotate.

I merged the changes into the OpenGL2 renderer though the fix for
tcMod turb doesn't translate.
2017-08-02 23:44:44 -05:00
Zack Middleton
6693465336 Don't try to remove non-existant command 'shaderstate'
Remove commands in the order they are added because the different
orders is annoying.
2017-07-27 18:58:46 -05:00
SmileTheory
d549b642bc OpenGL2: Use an OpenGL 3.2 core context if available. 2017-07-13 12:03:10 -07:00
Zack Middleton
dd73e19546 Improve warning for too many skin surfaces 2017-07-04 15:36:26 -05:00
Zack Middleton
904bbc1a8f Allow more than 32 surfaces in skin files
Models don't have a surface limit; skins shouldn't either. Some player
models require more than 32 surfaces since vanilla Quake 3 did not
enforce the limit.

Skins are now limited to 256 surfaces because having no limit would
require parsing the skin file twice. The skin surfaces are dynamically
allocated so it doesn't increase memory usage when less surfaces
are used.
2017-07-04 14:06:09 -05:00
Zack Middleton
4dffc52c1d Add warnings for animMap and videoMap shader keywords 2017-07-02 17:00:07 -05:00
Simon McVittie
2ab109b772 Avoid 'register' declarations
gcc 6 with -Wall -Wextra warns:

code/botlib/l_precomp.c: In function ‘PC_NameHash’:
code/botlib/l_precomp.c:551:2: warning: ‘register’ is not at beginning of declaration [-Wold-style-declaration]
  int register hash, i;
  ^~~

Modern compilers either ignore the register storage class when
generating code, or generate better code without it, so just remove
most of them.

The remaining uses are in third-party bundled libraries (libjpeg, zlib),
and in a PowerPC-specific inline function consisting of inline
assembler (because I'm not 100% confident that it doesn't have
some practical use there).
2016-11-01 16:37:38 +00:00
SmileTheory
497a74f22a Fix undefined behavior when shifting left by 32.
https://bugzilla.icculus.org/show_bug.cgi?id=6432
2016-09-07 16:56:23 -07:00
Victor Roemer
398dea397c Fix Makefile for OSX
Bump base SDK from 10.5 -> 10.7
Just use the builtin __APPLE__
2016-06-12 17:17:33 -04:00
Zack Middleton
2dcc5719e3 Explicitly set cull type for skybox
Explicitly set cull type for skybox to front, instead of using whatever
cull type the previous shader used (which could result in the skybox
not being visible due to only drawing back faces). The sky cloud stages
set the cull type so they are not affected by previous cull type.
2016-05-16 03:17:03 -05: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
ce35188acd Add support for uncompressed image upload flag to OpenGL1 2015-10-16 03:29:27 -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
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
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
Ensiform
43c7f1e734 Inform how many shader stages the max is in the warning message 2015-01-26 02:39:59 -06: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
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
Zack Middleton
a955d975b7 Add function for clearing global shader instead of duplicating the code 2014-09-27 01:35:35 -05:00
Tim Angus
d38039f975 Fix renderergl1 warnings 2014-09-01 11:31:39 +01:00
Tim Angus
621a72e698 Fix a few warnings 2014-08-30 17:29:23 +01:00
Zack Middleton
e742952db8 Port COM_ParseExt fixes to CommaParse 2014-08-28 20:34:05 -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
Zack Middleton
107cae63d6 Merge branch 'master' into sdl2
Conflicts:
	.travis.yml
2014-06-03 00:52:49 -05: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
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
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
Tequila
baca82d64e Bunch of comment fixes 2014-03-13 02:20:54 +01:00
Zack Middleton
63d1911c18 Parse q3map_sunExt in OpenGL1 too
Used for drawing sun, which is supported by both OpenGL1 and OpenGL2.
OpenGL2 already parses it.
2014-03-11 12:38:53 -05:00