mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Clearify some FIXMEs and bump the renderer API.
The last commits did some bigger changes to the interaction between the GL renderers and the client. The code is now SDL 2.0 conformant, window and context creation are strictly distinct operations. SDL is only initialized when necessary. Since this broke the client <-> renderer API, bump it's version. There a lot of things left to do for dark and cold winter evenings: * The software renderer implements it's own window handling and reinitialized SDL whenever vid_restart is called. This is highly problematic. * vid_fullscreen is abused to communicate changes to renderer config throughout the code. That's a very ugly, messy and potential very problematic hack. But not easy to remove. * Some funtion calls between the client and the renderer are unnecessary. The changes to the client <-> renderer interaction fixed issue #302.
This commit is contained in:
parent
6855f97487
commit
63350c418e
4 changed files with 28 additions and 17 deletions
|
@ -19,18 +19,7 @@
|
|||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* This is the "heart" of the id Tech 2 refresh engine. This file
|
||||
* implements the main window in which Quake II is running. The window
|
||||
* itself is created by the SDL backend, but here the refresh module is
|
||||
* loaded, initialized and it's interaction with the operating system
|
||||
* implemented. This code is also the interconnect between the input
|
||||
* system (the mouse) and the keyboard system, both are here tied
|
||||
* together with the refresher. The direct interaction between the
|
||||
* refresher and those subsystems are the main cause for the very
|
||||
* acurate and precise input controls of the id Tech 2.
|
||||
*
|
||||
* This implementation works for Windows and unixoid systems, but
|
||||
* other platforms may need an own implementation!
|
||||
* API between the client and renderers.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
@ -318,7 +307,7 @@ void *reflib_handle = NULL;
|
|||
qboolean ref_active = false;
|
||||
|
||||
/*
|
||||
* FIXME: Not with vid_fullscreen...
|
||||
* Restarts the renderer.
|
||||
*/
|
||||
void
|
||||
VID_Restart_f(void)
|
||||
|
@ -327,7 +316,9 @@ VID_Restart_f(void)
|
|||
}
|
||||
|
||||
/*
|
||||
* FIXME: This is only used by the softrenderer. Remove it.
|
||||
* FIXME: This is only used by the softrenderer. The software
|
||||
* renderer should be ported to the API provided by refresh.c
|
||||
* and this call removed.
|
||||
*/
|
||||
void
|
||||
VID_NewWindow(int width, int height)
|
||||
|
@ -462,7 +453,10 @@ VID_LoadRenderer(void)
|
|||
void
|
||||
VID_CheckChanges(void)
|
||||
{
|
||||
// FIXME: Not with vid_fullscreen
|
||||
// FIXME: Not with vid_fullscreen, should be a dedicated variable.
|
||||
// Sounds easy but this vid_fullscreen hack is really messy and
|
||||
// interacts with several critical places in both the client and
|
||||
// the renderers...
|
||||
if (vid_fullscreen->modified)
|
||||
{
|
||||
// Stop sound, because the clients blocks while
|
||||
|
|
|
@ -253,7 +253,10 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
|||
/* Reset SDL. */
|
||||
SDL_GL_ResetAttributes();
|
||||
|
||||
/* Let renderer prepare things (set OpenGL attributes) */
|
||||
/* Let renderer prepare things (set OpenGL attributes).
|
||||
FIXME: This is no longer necessary, the renderer
|
||||
could and should pass the flags when calling this
|
||||
function. */
|
||||
flags = re.PrepareForWindow();
|
||||
|
||||
if (flags == -1)
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef struct {
|
|||
} refdef_t;
|
||||
|
||||
// FIXME: bump API_VERSION?
|
||||
#define API_VERSION 4
|
||||
#define API_VERSION 5
|
||||
#define EXPORT
|
||||
#define IMPORT
|
||||
|
||||
|
|
|
@ -1556,6 +1556,20 @@ GetRefAPI(refimport_t imp)
|
|||
return re;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: The following functions implement the render backend
|
||||
* through SDL renderer. Only small parts belong here, refresh.c
|
||||
* (at client side) needs to grow support funtions for software
|
||||
* renderers and the renderer must use them. What's left here
|
||||
* should be moved to a new file sw_sdl.c.
|
||||
*
|
||||
* Very, very problematic is at least the SDL initalization and
|
||||
* window creation in this code. That is guaranteed to clash with
|
||||
* the GL renderers (when switching GL -> Soft or the other way
|
||||
* round) and works only by pure luck. And only as long as there
|
||||
* is only one software renderer.
|
||||
*/
|
||||
|
||||
static SDL_Window* window = NULL;
|
||||
static SDL_Surface *surface = NULL;
|
||||
static SDL_Texture *texture = NULL;
|
||||
|
|
Loading…
Reference in a new issue