2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 // vid.h -- video driver defs
25 #define ENGINE_ICON ( (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm )
27 extern int cl_available;
29 typedef struct viddef_s
31 // these are set by VID_Mode
37 qboolean userefreshrate;
44 extern void (*vid_menudrawfn)(void);
45 extern void (*vid_menukeyfn)(int key);
47 extern qboolean vid_hidden;
48 extern qboolean vid_activewindow;
49 extern cvar_t vid_hardwaregammasupported;
50 extern qboolean vid_usinghwgamma;
51 extern qboolean vid_supportrefreshrate;
53 extern cvar_t vid_fullscreen;
54 extern cvar_t vid_width;
55 extern cvar_t vid_height;
56 extern cvar_t vid_bitsperpixel;
57 extern cvar_t vid_samples;
58 extern cvar_t vid_refreshrate;
59 extern cvar_t vid_userefreshrate;
60 extern cvar_t vid_vsync;
61 extern cvar_t vid_mouse;
62 extern cvar_t vid_grabkeyboard;
63 extern cvar_t vid_stick_mouse;
64 extern cvar_t vid_resizable;
65 extern cvar_t vid_minwidth;
66 extern cvar_t vid_minheight;
68 extern cvar_t gl_combine;
69 extern cvar_t gl_finish;
71 extern cvar_t v_gamma;
72 extern cvar_t v_contrast;
73 extern cvar_t v_brightness;
74 extern cvar_t v_color_enable;
75 extern cvar_t v_color_black_r;
76 extern cvar_t v_color_black_g;
77 extern cvar_t v_color_black_b;
78 extern cvar_t v_color_grey_r;
79 extern cvar_t v_color_grey_g;
80 extern cvar_t v_color_grey_b;
81 extern cvar_t v_color_white_r;
82 extern cvar_t v_color_white_g;
83 extern cvar_t v_color_white_b;
84 extern cvar_t v_hwgamma;
86 extern int gl_stencil;
88 // brand of graphics chip
89 extern const char *gl_vendor;
90 // graphics chip model and other information
91 extern const char *gl_renderer;
92 // begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
93 extern const char *gl_version;
94 // extensions list, space separated
95 extern const char *gl_extensions;
97 extern const char *gl_platform;
98 // another extensions list, containing platform-specific extensions that are
99 // not in the main list
100 extern const char *gl_platformextensions;
101 // name of driver library (opengl32.dll, libGL.so.1, or whatever)
102 extern char gl_driver[256];
104 // compatibility hacks
105 extern qboolean isG200;
106 extern qboolean isRagePro;
108 // LordHavoc: GLX_SGI_swap_control and WGL_EXT_swap_control
109 extern int gl_videosyncavailable;
111 void *GL_GetProcAddress(const char *name);
112 int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *disableparm, int silent);
114 void VID_Shared_Init(void);
118 void VID_CheckExtensions(void);
120 void VID_Init (void);
123 void VID_Shutdown (void);
124 // Called at shutdown
126 int VID_SetMode (int modenum);
127 // sets the mode; only used by the Quake engine for resetting to mode 0 (the
128 // base mode) on memory allocation failures
130 int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer, int samples);
131 // allocates and opens an appropriate OpenGL context (and its window)
134 // sets hardware gamma correction, returns false if the device does not
135 // support gamma control
136 // (ONLY called by VID_UpdateGamma and VID_RestoreSystemGamma)
137 int VID_SetGamma(unsigned short *ramps, int rampsize);
138 // gets hardware gamma correction, returns false if the device does not
139 // support gamma control
140 // (ONLY called by VID_UpdateGamma and VID_RestoreSystemGamma)
141 int VID_GetGamma(unsigned short *ramps, int rampsize);
142 // makes sure ramp arrays are big enough and calls VID_GetGamma/VID_SetGamma
143 // (ONLY to be called from VID_Finish!)
144 void VID_UpdateGamma(qboolean force, int rampsize);
145 // turns off hardware gamma ramps immediately
146 // (called from various shutdown/deactivation functions)
147 void VID_RestoreSystemGamma(void);
149 void VID_Finish (qboolean allowmousegrab);
151 void VID_Restart_f(void);
153 void VID_Start(void);
155 extern unsigned int vid_gammatables_serial; // so other subsystems can poll if gamma parameters have changed; this starts with 0 and gets increased by 1 each time the gamma parameters get changed and VID_BuildGammaTables should be called again
156 extern qboolean vid_gammatables_trivial; // this is set to true if all color control values are at default setting, and it therefore would make no sense to use the gamma table
157 void VID_BuildGammaTables(unsigned short *ramps, int rampsize); // builds the current gamma tables into an array (needs 3*rampsize items)