mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
General cleanup of refresh.c.
* Even more syntax and code style fixes. * Rename functions to match their actual purpose. * Fix comments. * SDL initialization and shutdown is now client side only. With SDL 1.2 finally gone there's no need to involve the renderers in it. This breaks the client <-> renderer API. I haven't bumped the API version with this commit because there're likely more changes when I'm going through the renderer side of things. The VID backend also needs a lot of love... It might be a good idea to move this SDL backend files into the client and rename them. We'll decide that at a later time.
This commit is contained in:
parent
333d19766f
commit
5db73a795b
8 changed files with 147 additions and 135 deletions
|
@ -205,6 +205,8 @@ VID_CheckChanges(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern qboolean GLimp_Init(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_Init(void)
|
VID_Init(void)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +219,12 @@ VID_Init(void)
|
||||||
Cmd_AddCommand("vid_restart", VID_Restart_f);
|
Cmd_AddCommand("vid_restart", VID_Restart_f);
|
||||||
Cmd_AddCommand("vid_listmodes", VID_ListModes_f);
|
Cmd_AddCommand("vid_listmodes", VID_ListModes_f);
|
||||||
|
|
||||||
|
/* Initialize the backend. */
|
||||||
|
if (!GLimp_Init())
|
||||||
|
{
|
||||||
|
Com_Error(ERR_FATAL, "Couldn't initialize the graphics subsystem!\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Start the graphics mode and load refresh DLL */
|
/* Start the graphics mode and load refresh DLL */
|
||||||
VID_CheckChanges();
|
VID_CheckChanges();
|
||||||
}
|
}
|
||||||
|
@ -331,10 +339,10 @@ void *reflib_handle = NULL; // Handle to refresh DLL
|
||||||
qboolean ref_active = false; /* Is the refresher being used? */
|
qboolean ref_active = false; /* Is the refresher being used? */
|
||||||
|
|
||||||
void Key_MarkAllUp(void);
|
void Key_MarkAllUp(void);
|
||||||
|
void VID_ShutdownRenderer(void);
|
||||||
|
|
||||||
extern int GLimp_Init(void);
|
|
||||||
extern qboolean GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight);
|
extern qboolean GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight);
|
||||||
extern void VID_ShutdownWindow(void);
|
extern void GLimp_ShutdownGraphics(void);
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
VID_LoadRefresh(void)
|
VID_LoadRefresh(void)
|
||||||
|
@ -354,7 +362,7 @@ VID_LoadRefresh(void)
|
||||||
|
|
||||||
// If the refresher is already active
|
// If the refresher is already active
|
||||||
// we'll shut it down
|
// we'll shut it down
|
||||||
VID_Shutdown();
|
VID_ShutdownRenderer();
|
||||||
|
|
||||||
// Log it!
|
// Log it!
|
||||||
Com_Printf("----- refresher initialization -----\n");
|
Com_Printf("----- refresher initialization -----\n");
|
||||||
|
@ -390,9 +398,8 @@ VID_LoadRefresh(void)
|
||||||
ri.Vid_NewWindow = VID_NewWindow;
|
ri.Vid_NewWindow = VID_NewWindow;
|
||||||
ri.Vid_WriteScreenshot = VID_WriteScreenshot;
|
ri.Vid_WriteScreenshot = VID_WriteScreenshot;
|
||||||
|
|
||||||
ri.Vid_ShutdownWindow = VID_ShutdownWindow;
|
|
||||||
ri.GLimp_Init = GLimp_Init;
|
|
||||||
ri.GLimp_InitGraphics = GLimp_InitGraphics;
|
ri.GLimp_InitGraphics = GLimp_InitGraphics;
|
||||||
|
ri.GLimp_ShutdownGraphics = GLimp_ShutdownGraphics;
|
||||||
|
|
||||||
re = GetRefAPI( ri );
|
re = GetRefAPI( ri );
|
||||||
|
|
||||||
|
@ -401,14 +408,14 @@ VID_LoadRefresh(void)
|
||||||
|
|
||||||
if (re.api_version != API_VERSION)
|
if (re.api_version != API_VERSION)
|
||||||
{
|
{
|
||||||
VID_Shutdown();
|
VID_ShutdownRenderer();
|
||||||
Com_Error (ERR_FATAL, "%s has incompatible api_version %d", reflib_name, re.api_version);
|
Com_Error (ERR_FATAL, "%s has incompatible api_version %d", reflib_name, re.api_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate the refresher
|
// Initiate the refresher
|
||||||
if (!re.Init())
|
if (!re.Init())
|
||||||
{
|
{
|
||||||
VID_Shutdown(); // Isn't that just too bad? :(
|
VID_ShutdownRenderer(); // Isn't that just too bad? :(
|
||||||
Com_Printf("ERROR: Loading %s as rendering backend failed!\n", reflib_name);
|
Com_Printf("ERROR: Loading %s as rendering backend failed!\n", reflib_name);
|
||||||
Com_Printf("------------------------------------\n\n");
|
Com_Printf("------------------------------------\n\n");
|
||||||
return false; // TODO: try again with default renderer?
|
return false; // TODO: try again with default renderer?
|
||||||
|
@ -423,7 +430,7 @@ VID_LoadRefresh(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_Shutdown(void)
|
VID_ShutdownRenderer(void)
|
||||||
{
|
{
|
||||||
if (ref_active)
|
if (ref_active)
|
||||||
{
|
{
|
||||||
|
@ -438,6 +445,15 @@ VID_Shutdown(void)
|
||||||
ref_active = false;
|
ref_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void GLimp_Shutdown(void);
|
||||||
|
|
||||||
|
void
|
||||||
|
VID_Shutdown(void)
|
||||||
|
{
|
||||||
|
VID_ShutdownRenderer();
|
||||||
|
GLimp_Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
// ======== wrappers for functions from refresh lib ========
|
// ======== wrappers for functions from refresh lib ========
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -18,55 +18,75 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
* 02111-1307, USA.
|
* 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* CalculateGammaRamp() is derived from SDL2's SDL_CalculateGammaRamp()
|
|
||||||
* (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
* Published under zlib License: http://www.libsdl.org/license.php
|
|
||||||
*
|
|
||||||
* =======================================================================
|
* =======================================================================
|
||||||
*
|
*
|
||||||
* This file implements an OpenGL context and window handling through
|
* This is the client side of the render backend, implemented trough SDL.
|
||||||
* SDL. The code is complicated by supporting the fairly different SDL
|
* The SDL window and related functrion (mouse grap, fullscreen switch)
|
||||||
* 1.2 and SDL 2 APIs, each with hardware gamma or software gamma by
|
* are implemented here, everything else is in the renderers.
|
||||||
* RANDR.
|
|
||||||
*
|
*
|
||||||
* =======================================================================
|
* =======================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../common/header/common.h" /* CVar_*, qboolean (through shared.h) */
|
#include "../../common/header/common.h"
|
||||||
#include "../../client/header/ref.h"
|
#include "../../client/header/ref.h"
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_video.h>
|
#include <SDL2/SDL_video.h>
|
||||||
|
|
||||||
static SDL_Window* window = NULL;
|
|
||||||
cvar_t *vid_displayrefreshrate;
|
cvar_t *vid_displayrefreshrate;
|
||||||
|
int glimp_refreshRate = -1;
|
||||||
|
|
||||||
/*
|
static SDL_Window* window = NULL;
|
||||||
* Initializes the SDL video subsystem
|
static qboolean initSuccessful = false;
|
||||||
*/
|
|
||||||
int
|
// --------
|
||||||
GLimp_Init(void)
|
|
||||||
|
static qboolean
|
||||||
|
CreateSDLWindow(int flags, int w, int h)
|
||||||
{
|
{
|
||||||
vid_displayrefreshrate = Cvar_Get("vid_displayrefreshrate", "-1", CVAR_ARCHIVE);
|
int windowPos = SDL_WINDOWPOS_UNDEFINED;
|
||||||
|
|
||||||
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
window = SDL_CreateWindow("Yamagi Quake II", windowPos, windowPos, w, h, flags);
|
||||||
|
|
||||||
|
return window != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
GetFullscreenType()
|
||||||
|
{
|
||||||
|
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||||
{
|
{
|
||||||
|
return 1;
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) == -1)
|
|
||||||
{
|
|
||||||
Com_Printf("Couldn't init SDL video: %s.\n", SDL_GetError());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_version version;
|
|
||||||
|
|
||||||
SDL_GetVersion(&version);
|
|
||||||
Com_Printf("SDL version is: %i.%i.%i\n", (int)version.major, (int)version.minor, (int)version.patch);
|
|
||||||
Com_Printf("SDL video driver is \"%s\".\n", SDL_GetCurrentVideoDriver());
|
|
||||||
}
|
}
|
||||||
|
else if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN)
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean
|
||||||
|
GetWindowSize(int* w, int* h)
|
||||||
|
{
|
||||||
|
if (window == NULL || w == NULL || h == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_DisplayMode m;
|
||||||
|
|
||||||
|
if (SDL_GetWindowDisplayMode(window, &m) != 0)
|
||||||
|
{
|
||||||
|
Com_Printf("Can't get Displaymode: %s\n", SDL_GetError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*w = m.w;
|
||||||
|
*h = m.h;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -74,11 +94,11 @@ GLimp_Init(void)
|
||||||
/*
|
/*
|
||||||
* Sets the window icon
|
* Sets the window icon
|
||||||
*/
|
*/
|
||||||
#include "icon/q2icon64.h" // 64x64 32 Bit
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetSDLIcon()
|
SetSDLIcon()
|
||||||
{
|
{
|
||||||
|
#include "icon/q2icon64.h" // 64x64 32 Bit
|
||||||
|
|
||||||
/* these masks are needed to tell SDL_CreateRGBSurface(From)
|
/* these masks are needed to tell SDL_CreateRGBSurface(From)
|
||||||
to assume the data it gets is byte-wise RGB(A) data */
|
to assume the data it gets is byte-wise RGB(A) data */
|
||||||
Uint32 rmask, gmask, bmask, amask;
|
Uint32 rmask, gmask, bmask, amask;
|
||||||
|
@ -103,57 +123,56 @@ SetSDLIcon()
|
||||||
SDL_FreeSurface(icon);
|
SDL_FreeSurface(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsFullscreen()
|
// --------
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initializes the SDL video subsystem. Must
|
||||||
|
* be called before anything else.
|
||||||
|
*/
|
||||||
|
qboolean
|
||||||
|
GLimp_Init(void)
|
||||||
{
|
{
|
||||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_DESKTOP)
|
vid_displayrefreshrate = Cvar_Get("vid_displayrefreshrate", "-1", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
if (!SDL_WasInit(SDL_INIT_VIDEO))
|
||||||
{
|
{
|
||||||
return 1;
|
if (SDL_Init(SDL_INIT_VIDEO) == -1)
|
||||||
|
{
|
||||||
|
Com_Printf("Couldn't init SDL video: %s.\n", SDL_GetError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_version version;
|
||||||
|
|
||||||
|
SDL_GetVersion(&version);
|
||||||
|
Com_Printf("SDL version is: %i.%i.%i\n", (int)version.major, (int)version.minor, (int)version.patch);
|
||||||
|
Com_Printf("SDL video driver is \"%s\".\n", SDL_GetCurrentVideoDriver());
|
||||||
}
|
}
|
||||||
else if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN)
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean CreateSDLWindow(int flags, int w, int h)
|
|
||||||
{
|
|
||||||
int windowPos = SDL_WINDOWPOS_UNDEFINED;
|
|
||||||
|
|
||||||
window = SDL_CreateWindow("Yamagi Quake II", windowPos, windowPos, w, h, flags);
|
|
||||||
|
|
||||||
return window != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean GetWindowSize(int* w, int* h)
|
|
||||||
{
|
|
||||||
if(window == NULL || w == NULL || h == NULL)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_DisplayMode m;
|
|
||||||
|
|
||||||
if(SDL_GetWindowDisplayMode(window, &m) != 0)
|
|
||||||
{
|
|
||||||
Com_Printf("Can't get Displaymode: %s\n", SDL_GetError());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*w = m.w;
|
|
||||||
*h = m.h;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean initSuccessful = false;
|
/*
|
||||||
|
* Shuts the SDL video subsystem down. Must
|
||||||
|
* be called after evrything's finished and
|
||||||
|
* clean up.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
GLimp_Shutdown(void)
|
||||||
|
{
|
||||||
|
if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_VIDEO)
|
||||||
|
{
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the OpenGL window
|
* (Re)initializes the actual window.
|
||||||
*/
|
*/
|
||||||
qboolean
|
qboolean
|
||||||
GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
|
@ -173,19 +192,22 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
fs_flag = SDL_WINDOW_FULLSCREEN;
|
fs_flag = SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only do this if we already have a working window and fully initialized rendering backend
|
/* Only do this if we already have a working window and a fully
|
||||||
// (GLimp_InitGraphics() is also called when recovering if creating GL context fails or the one we got is unusable)
|
initialized rendering backend GLimp_InitGraphics() is also
|
||||||
if (initSuccessful && GetWindowSize(&curWidth, &curHeight) && (curWidth == width) && (curHeight == height))
|
called when recovering if creating GL context fails or the
|
||||||
|
one we got is unusable. */
|
||||||
|
if (initSuccessful && GetWindowSize(&curWidth, &curHeight)
|
||||||
|
&& (curWidth == width) && (curHeight == height))
|
||||||
{
|
{
|
||||||
/* If we want fullscreen, but aren't */
|
/* If we want fullscreen, but aren't */
|
||||||
if (fullscreen != IsFullscreen())
|
if (GetFullscreenType())
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(window, fs_flag);
|
SDL_SetWindowFullscreen(window, fs_flag);
|
||||||
Cvar_SetValue("vid_fullscreen", fullscreen);
|
Cvar_SetValue("vid_fullscreen", fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we now? */
|
/* Are we now? */
|
||||||
if (fullscreen == IsFullscreen())
|
if (GetFullscreenType())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -203,12 +225,12 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
/* Create the window */
|
/* Create the window */
|
||||||
VID_NewWindow(width, height);
|
VID_NewWindow(width, height);
|
||||||
|
|
||||||
// let renderer prepare things (set OpenGL attributes)
|
/* Let renderer prepare things (set OpenGL attributes) */
|
||||||
flags = re.PrepareForWindow();
|
flags = re.PrepareForWindow();
|
||||||
|
|
||||||
if (flags == -1)
|
if (flags == -1)
|
||||||
{
|
{
|
||||||
// hopefully PrepareForWindow() logged an error
|
/* It's PrepareForWindow() job to log an error */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,9 +239,7 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
flags |= fs_flag;
|
flags |= fs_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set window icon - For SDL1.2, this must be done before creating the window */
|
/* Mkay, now the hard work. Let's create the window. */
|
||||||
SetSDLIcon();
|
|
||||||
|
|
||||||
cvar_t *gl_msaa_samples = Cvar_Get("gl_msaa_samples", "0", CVAR_ARCHIVE);
|
cvar_t *gl_msaa_samples = Cvar_Get("gl_msaa_samples", "0", CVAR_ARCHIVE);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -266,9 +286,9 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!re.InitContext(window))
|
if (!re.InitContext(window))
|
||||||
{
|
{
|
||||||
// InitContext() should have logged an error
|
/* InitContext() should have logged an error. */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +306,8 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
/*
|
/*
|
||||||
* (Un)grab Input
|
* (Un)grab Input
|
||||||
*/
|
*/
|
||||||
void GLimp_GrabInput(qboolean grab)
|
void
|
||||||
|
GLimp_GrabInput(qboolean grab)
|
||||||
{
|
{
|
||||||
if(window != NULL)
|
if(window != NULL)
|
||||||
{
|
{
|
||||||
|
@ -300,20 +321,21 @@ void GLimp_GrabInput(qboolean grab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int glimp_refreshRate = -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the current display refresh rate.
|
* Returns the current display refresh rate.
|
||||||
*/
|
*/
|
||||||
int GLimp_GetRefreshRate(void)
|
int
|
||||||
|
GLimp_GetRefreshRate(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (vid_displayrefreshrate->value > -1)
|
if (vid_displayrefreshrate->value > -1)
|
||||||
{
|
{
|
||||||
glimp_refreshRate = ceil(vid_displayrefreshrate->value);
|
glimp_refreshRate = ceil(vid_displayrefreshrate->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do this only once, assuming people don't change their display settings
|
/* Do this only once. We asume that no one will change their
|
||||||
// or plug in new displays while the game is running
|
refresh rate or plug new display hardware in while the
|
||||||
|
game is running. */
|
||||||
if (glimp_refreshRate == -1)
|
if (glimp_refreshRate == -1)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
@ -327,7 +349,8 @@ int GLimp_GetRefreshRate(void)
|
||||||
|
|
||||||
if (glimp_refreshRate <= 0)
|
if (glimp_refreshRate <= 0)
|
||||||
{
|
{
|
||||||
glimp_refreshRate = 60; // apparently the stuff above failed, use default
|
/* Apparently the stuff above failed, use default */
|
||||||
|
glimp_refreshRate = 60;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +368,7 @@ int GLimp_GetRefreshRate(void)
|
||||||
* Shuts the SDL render backend down
|
* Shuts the SDL render backend down
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
VID_ShutdownWindow(void)
|
GLimp_ShutdownGraphics(void)
|
||||||
{
|
{
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
|
@ -360,13 +383,4 @@ VID_ShutdownWindow(void)
|
||||||
glimp_refreshRate = -1;
|
glimp_refreshRate = -1;
|
||||||
|
|
||||||
initSuccessful = false; // not initialized anymore
|
initSuccessful = false; // not initialized anymore
|
||||||
|
|
||||||
if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_VIDEO)
|
|
||||||
{
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,9 +232,8 @@ typedef struct
|
||||||
// expects the pixels data to be row-wise, starting at top left
|
// expects the pixels data to be row-wise, starting at top left
|
||||||
void (IMPORT *Vid_WriteScreenshot)( int width, int height, int comp, const void* data );
|
void (IMPORT *Vid_WriteScreenshot)( int width, int height, int comp, const void* data );
|
||||||
|
|
||||||
void (IMPORT *Vid_ShutdownWindow)(void);
|
|
||||||
int (IMPORT *GLimp_Init)(void);
|
|
||||||
qboolean (IMPORT *GLimp_InitGraphics)(int fullscreen, int *pwidth, int *pheight);
|
qboolean (IMPORT *GLimp_InitGraphics)(int fullscreen, int *pwidth, int *pheight);
|
||||||
|
void (IMPORT *GLimp_ShutdownGraphics)(void);
|
||||||
} refimport_t;
|
} refimport_t;
|
||||||
|
|
||||||
// this is the only function actually exported at the linker level
|
// this is the only function actually exported at the linker level
|
||||||
|
|
|
@ -1406,13 +1406,6 @@ RI_Init()
|
||||||
/* initialize our QGL dynamic bindings */
|
/* initialize our QGL dynamic bindings */
|
||||||
QGL_Init();
|
QGL_Init();
|
||||||
|
|
||||||
/* initialize OS-specific parts of OpenGL */
|
|
||||||
if (!ri.GLimp_Init())
|
|
||||||
{
|
|
||||||
QGL_Shutdown();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set our "safe" mode */
|
/* set our "safe" mode */
|
||||||
gl_state.prev_mode = 4;
|
gl_state.prev_mode = 4;
|
||||||
gl_state.stereo_mode = gl1_stereo->value;
|
gl_state.stereo_mode = gl1_stereo->value;
|
||||||
|
|
|
@ -223,7 +223,7 @@ RI_ShutdownWindow(qboolean contextOnly)
|
||||||
|
|
||||||
if (!contextOnly)
|
if (!contextOnly)
|
||||||
{
|
{
|
||||||
ri.Vid_ShutdownWindow();
|
ri.GLimp_ShutdownGraphics();
|
||||||
|
|
||||||
window = NULL;
|
window = NULL;
|
||||||
gl_state.hwgamma = false;
|
gl_state.hwgamma = false;
|
||||||
|
|
|
@ -363,8 +363,7 @@ GL3_SetMode(void)
|
||||||
vid.width = r_customwidth->value;
|
vid.width = r_customwidth->value;
|
||||||
vid.height = r_customheight->value;
|
vid.height = r_customheight->value;
|
||||||
|
|
||||||
if ((err = SetMode_impl(&vid.width, &vid.height, r_mode->value,
|
if ((err = SetMode_impl(&vid.width, &vid.height, r_mode->value, fullscreen)) == rserr_ok)
|
||||||
fullscreen)) == rserr_ok)
|
|
||||||
{
|
{
|
||||||
if (r_mode->value == -1)
|
if (r_mode->value == -1)
|
||||||
{
|
{
|
||||||
|
@ -454,13 +453,6 @@ GL3_Init(void)
|
||||||
|
|
||||||
GL3_Register();
|
GL3_Register();
|
||||||
|
|
||||||
/* initialize OS-specific parts of OpenGL */
|
|
||||||
if (!ri.GLimp_Init())
|
|
||||||
{
|
|
||||||
//QGL_Shutdown();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set our "safe" mode */
|
/* set our "safe" mode */
|
||||||
gl3state.prev_mode = 4;
|
gl3state.prev_mode = 4;
|
||||||
//gl_state.stereo_mode = gl1_stereo->value;
|
//gl_state.stereo_mode = gl1_stereo->value;
|
||||||
|
|
|
@ -288,7 +288,7 @@ void GL3_ShutdownWindow(qboolean contextOnly)
|
||||||
|
|
||||||
if (!contextOnly)
|
if (!contextOnly)
|
||||||
{
|
{
|
||||||
ri.Vid_ShutdownWindow();
|
ri.GLimp_ShutdownGraphics();
|
||||||
|
|
||||||
window = NULL;
|
window = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,8 +361,6 @@ RE_Init(void)
|
||||||
|
|
||||||
R_Register ();
|
R_Register ();
|
||||||
Draw_GetPalette ();
|
Draw_GetPalette ();
|
||||||
if (!ri.GLimp_Init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// create the window
|
// create the window
|
||||||
RE_BeginFrame( 0 );
|
RE_BeginFrame( 0 );
|
||||||
|
|
Loading…
Reference in a new issue