mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-21 20:21:09 +00:00
Add support for MSAA.
MSAA was a long wanted and often requested feature. Just set set the desired number of samples with gl_msaa_samples and do a vid_restart. This code is based upon work done in Hecatomb.
This commit is contained in:
parent
85ee926dd6
commit
26bbfead45
6 changed files with 33 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
|||
Quake II 5.21 to 5.22:
|
||||
- Provide a fallback if SDL2s relative mouse mode
|
||||
cannot be activated.
|
||||
- Add support for MSAA through the gl_msaa_samples
|
||||
cvar.
|
||||
|
||||
Quake II 5.20 to 5.21:
|
||||
- Fix a bug regaring mouse key handling (reported
|
||||
|
|
5
LICENSE
5
LICENSE
|
@ -9,11 +9,12 @@ copys for each license:
|
|||
Parts of other Quake II Clients were included into the source. They
|
||||
covered by the same GPLv2 license as Quake II itself:
|
||||
|
||||
- Hecatomb
|
||||
- Icculus Quake 2
|
||||
- r1q2
|
||||
- QuDoS
|
||||
- KMQuake2
|
||||
- Q2Pro
|
||||
- QuDoS
|
||||
- r1q2
|
||||
- zeq2
|
||||
|
||||
The following code is used in library form and thus not part of Yamagi
|
||||
|
|
|
@ -505,10 +505,11 @@ GLimp_InitGraphics(qboolean fullscreen)
|
|||
{
|
||||
int counter = 0;
|
||||
int flags;
|
||||
int msaa_samples;
|
||||
int stencil_bits;
|
||||
int width, height;
|
||||
char title[24];
|
||||
|
||||
int width, height;
|
||||
|
||||
if (GetWindowSize(&width, &height) && (width == vid.width) && (height == vid.height))
|
||||
{
|
||||
|
@ -546,6 +547,22 @@ GLimp_InitGraphics(qboolean fullscreen)
|
|||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
||||
|
||||
if (gl_msaa_samples->value)
|
||||
{
|
||||
msaa_samples = gl_msaa_samples->value;
|
||||
|
||||
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) == -1)
|
||||
{
|
||||
Com_Printf("MSAA is unsupported: %s\n", SDL_GetError());
|
||||
Cvar_SetValue ("gl_msaa_samples", 0);
|
||||
}
|
||||
else if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa_samples) == -1)
|
||||
{
|
||||
Com_Printf("%i MSAA are unsupported: %s\n", msaa_samples, SDL_GetError());
|
||||
Cvar_SetValue("gl_msaa_samples", 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initiate the flags */
|
||||
flags = SDL_OPENGL;
|
||||
|
||||
|
|
|
@ -242,6 +242,7 @@ extern cvar_t *gl_texturealphamode;
|
|||
extern cvar_t *gl_texturesolidmode;
|
||||
extern cvar_t *gl_saturatelighting;
|
||||
extern cvar_t *gl_lockpvs;
|
||||
extern cvar_t *gl_msaa_samples;
|
||||
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_gamma;
|
||||
|
|
|
@ -139,6 +139,7 @@ cvar_t *gl_texturesolidmode;
|
|||
cvar_t *gl_anisotropic;
|
||||
cvar_t *gl_anisotropic_avail;
|
||||
cvar_t *gl_lockpvs;
|
||||
cvar_t *gl_msaa_samples;
|
||||
|
||||
cvar_t *vid_fullscreen;
|
||||
cvar_t *vid_gamma;
|
||||
|
@ -1015,6 +1016,7 @@ R_Register(void)
|
|||
|
||||
gl_customwidth = Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
|
||||
gl_customheight = Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
|
||||
gl_msaa_samples = Cvar_Get ( "gl_msaa_samples", "0", CVAR_ARCHIVE );
|
||||
|
||||
#ifdef RETEXTURE
|
||||
gl_retexturing = Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE);
|
||||
|
|
|
@ -164,6 +164,7 @@ void
|
|||
R_SetDefaultState(void)
|
||||
{
|
||||
glClearColor(1, 0, 0.5, 0.5);
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
glCullFace(GL_FRONT);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
|
@ -216,8 +217,13 @@ R_SetDefaultState(void)
|
|||
if (qglColorTableEXT && gl_ext_palettedtexture->value)
|
||||
{
|
||||
glEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
|
||||
|
||||
R_SetTexturePalette(d_8to24table);
|
||||
}
|
||||
|
||||
if (gl_msaa_samples->value)
|
||||
{
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue