extern struct cvar_s v_color_white_g;
extern struct cvar_s v_color_white_b;
+extern cvar_t gl_info_vendor;
+extern cvar_t gl_info_renderer;
+extern cvar_t gl_info_version;
+extern cvar_t gl_info_extensions;
+extern cvar_t gl_info_platform;
+extern cvar_t gl_info_driver;
+
// brand of graphics chip
extern const char *gl_vendor;
// graphics chip model and other information
extern const char *gl_renderer;
// begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
extern const char *gl_version;
-// extensions list, space separated
-extern const char *gl_extensions;
-// WGL, GLX, or AGL
-extern const char *gl_platform;
-// name of driver library (opengl32.dll, libGL.so.1, or whatever)
-extern char gl_driver[256];
+
void *GL_GetProcAddress(const char *name);
qbool GL_CheckExtension(const char *name, const char *disableparm, int silent);
static qbool vid_usingmouse_relativeworks = false; // SDL2 workaround for unimplemented RelativeMouse mode
static qbool vid_usinghidecursor = false;
static qbool vid_hasfocus = false;
-static qbool vid_isfullscreen;
static qbool vid_usingvsync = false;
static SDL_Joystick *vid_sdljoystick = NULL;
static SDL_GameController *vid_sdlgamecontroller = NULL;
vid_sdl_initjoysticksystem = SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0;
if (!vid_sdl_initjoysticksystem)
Con_Printf(CON_ERROR "Failed to init SDL joystick subsystem: %s\n", SDL_GetError());
- vid_isfullscreen = false;
}
static int vid_sdljoystickindex = -1;
}
#endif
-extern cvar_t gl_info_vendor;
-extern cvar_t gl_info_renderer;
-extern cvar_t gl_info_version;
-extern cvar_t gl_info_platform;
-extern cvar_t gl_info_driver;
-
static qbool VID_InitModeGL(viddef_mode_t *mode)
{
int windowflags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
int yPos = SDL_WINDOWPOS_UNDEFINED;
int i;
#ifndef USE_GLES2
- const char *drivername;
+ // SDL usually knows best
+ const char *drivername = NULL;
#endif
win_half_width = mode->width>>1;
VID_OutputVersion();
#ifndef USE_GLES2
- // SDL usually knows best
- drivername = NULL;
-
// COMMANDLINEOPTION: SDL GL: -gl_driver <drivername> selects a GL driver library, default is whatever SDL recommends, useful only for 3dfxogl.dll/3dfxvgl.dll or fxmesa or similar, if you don't know what this is for, you don't need it
i = Sys_CheckParm("-gl_driver");
if (i && i < sys.argc - 1)
windowflags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS;
#endif
- vid_isfullscreen = false;
+
+ if (mode->fullscreen)
{
- if (mode->fullscreen) {
- if (vid_desktopfullscreen.integer)
- {
- vid_mode_t *m = VID_GetDesktopMode();
- mode->width = m->width;
- mode->height = m->height;
- windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
- }
- else
- windowflags |= SDL_WINDOW_FULLSCREEN;
- vid_isfullscreen = true;
+ if (vid_desktopfullscreen.integer)
+ {
+ vid_mode_t *m = VID_GetDesktopMode();
+ mode->width = m->width;
+ mode->height = m->height;
+ windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
- else {
- if (vid_borderless.integer)
- windowflags |= SDL_WINDOW_BORDERLESS;
+ else
+ windowflags |= SDL_WINDOW_FULLSCREEN;
+ }
+ else
+ {
+ if (vid_borderless.integer)
+ windowflags |= SDL_WINDOW_BORDERLESS;
#ifdef WIN32
- if (vid_ignore_taskbar.integer) {
- xPos = SDL_WINDOWPOS_CENTERED;
- yPos = SDL_WINDOWPOS_CENTERED;
- }
- else {
- RECT rect;
- AdjustWindowBounds(mode, &rect);
- xPos = rect.left;
- yPos = rect.top;
- }
-#endif
+ if (vid_ignore_taskbar.integer)
+ {
+ xPos = SDL_WINDOWPOS_CENTERED;
+ yPos = SDL_WINDOWPOS_CENTERED;
+ }
+ else
+ {
+ RECT rect;
+ AdjustWindowBounds(mode, &rect);
+ xPos = rect.left;
+ yPos = rect.top;
}
+#endif
}
- //flags |= SDL_HWSURFACE;
- if (vid_mouse_clickthrough.integer && !vid_isfullscreen)
+
+ if (vid_mouse_clickthrough.integer)
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetSwapInterval(bound(-1, vid_vsync.integer, 1));
vid_usingvsync = (vid_vsync.integer != 0);
- gl_platform = "SDL";
-
GL_Setup();
// VorteX: set other info
Cvar_SetQuick(&gl_info_vendor, gl_vendor);
Cvar_SetQuick(&gl_info_renderer, gl_renderer);
Cvar_SetQuick(&gl_info_version, gl_version);
- Cvar_SetQuick(&gl_info_platform, gl_platform ? gl_platform : "");
- Cvar_SetQuick(&gl_info_driver, gl_driver);
+ Cvar_SetQuick(&gl_info_platform, "SDL");
+ Cvar_SetQuick(&gl_info_driver, drivername ? drivername : "");
// clear to black (loading plaque will be seen over this)
GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 0);
return true;
}
-extern cvar_t gl_info_extensions;
-extern cvar_t gl_info_vendor;
-extern cvar_t gl_info_renderer;
-extern cvar_t gl_info_version;
-extern cvar_t gl_info_platform;
-extern cvar_t gl_info_driver;
-
qbool VID_InitMode(viddef_mode_t *mode)
{
// GAME_STEELSTORM specific
window = NULL;
SDL_QuitSubSystem(SDL_INIT_VIDEO);
-
- gl_driver[0] = 0;
- gl_extensions = "";
- gl_platform = "";
}
void VID_Finish (void)
cvar_t gl_info_renderer = {CF_CLIENT | CF_READONLY, "gl_info_renderer", "", "indicates graphics chip model and other information"};
cvar_t gl_info_version = {CF_CLIENT | CF_READONLY, "gl_info_version", "", "indicates version of current renderer. begins with 1.0.0, 1.1.0, 1.2.0, 1.3.1 etc."};
cvar_t gl_info_extensions = {CF_CLIENT | CF_READONLY, "gl_info_extensions", "", "indicates extension list found by engine, space separated."};
-cvar_t gl_info_platform = {CF_CLIENT | CF_READONLY, "gl_info_platform", "", "indicates GL platform: WGL, GLX, or AGL."};
+cvar_t gl_info_platform = {CF_CLIENT | CF_READONLY, "gl_info_platform", "", "indicates GL platform: SDL, SDL, or SDL."};
cvar_t gl_info_driver = {CF_CLIENT | CF_READONLY, "gl_info_driver", "", "name of driver library (opengl32.dll, libGL.so.1, or whatever)."};
cvar_t vid_fullscreen = {CF_CLIENT | CF_ARCHIVE, "vid_fullscreen", "1", "use fullscreen (1) or windowed (0)"};
const char *gl_renderer;
// begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
const char *gl_version;
-// extensions list, space separated
-const char *gl_extensions;
-// WGL, GLX, or AGL
-const char *gl_platform;
-// name of driver library (opengl32.dll, libGL.so.1, or whatever)
-char gl_driver[256];
#ifndef USE_GLES2
GLboolean (GLAPIENTRY *qglIsBuffer) (GLuint buffer);