]> icculus.org git repositories - divverent/darkplaces.git/blob - vid.h
changed VID_InitMode to take a viddef_mode_t structure which contains
[divverent/darkplaces.git] / vid.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
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.
8
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.
12
13 See the GNU General Public License for more details.
14
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.
18
19 */
20 // vid.h -- video driver defs
21
22 #ifndef VID_H
23 #define VID_H
24
25 #define ENGINE_ICON ( (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm )
26
27 extern int cl_available;
28
29 typedef struct viddef_mode_s
30 {
31         int width;
32         int height;
33         int bitsperpixel;
34         qboolean fullscreen;
35         float refreshrate;
36         qboolean userefreshrate;
37         qboolean stereobuffer;
38         int samples;
39 }
40 viddef_mode_t;
41
42 typedef struct viddef_s
43 {
44         // these are set by VID_Mode
45         viddef_mode_t mode;
46         int width;
47         int height;
48         int bitsperpixel;
49         qboolean fullscreen;
50         int refreshrate;
51         qboolean userefreshrate;
52         qboolean stereobuffer;
53         int samples;
54 } viddef_t;
55
56 // global video state
57 extern viddef_t vid;
58 extern void (*vid_menudrawfn)(void);
59 extern void (*vid_menukeyfn)(int key);
60
61 extern qboolean vid_hidden;
62 extern qboolean vid_activewindow;
63 extern cvar_t vid_hardwaregammasupported;
64 extern qboolean vid_usinghwgamma;
65 extern qboolean vid_supportrefreshrate;
66
67 extern cvar_t vid_fullscreen;
68 extern cvar_t vid_width;
69 extern cvar_t vid_height;
70 extern cvar_t vid_bitsperpixel;
71 extern cvar_t vid_samples;
72 extern cvar_t vid_refreshrate;
73 extern cvar_t vid_userefreshrate;
74 extern cvar_t vid_vsync;
75 extern cvar_t vid_mouse;
76 extern cvar_t vid_grabkeyboard;
77 extern cvar_t vid_stick_mouse;
78 extern cvar_t vid_resizable;
79 extern cvar_t vid_minwidth;
80 extern cvar_t vid_minheight;
81
82 extern cvar_t gl_combine;
83 extern cvar_t gl_finish;
84
85 extern cvar_t v_gamma;
86 extern cvar_t v_contrast;
87 extern cvar_t v_brightness;
88 extern cvar_t v_color_enable;
89 extern cvar_t v_color_black_r;
90 extern cvar_t v_color_black_g;
91 extern cvar_t v_color_black_b;
92 extern cvar_t v_color_grey_r;
93 extern cvar_t v_color_grey_g;
94 extern cvar_t v_color_grey_b;
95 extern cvar_t v_color_white_r;
96 extern cvar_t v_color_white_g;
97 extern cvar_t v_color_white_b;
98 extern cvar_t v_hwgamma;
99
100 extern int gl_stencil;
101
102 // brand of graphics chip
103 extern const char *gl_vendor;
104 // graphics chip model and other information
105 extern const char *gl_renderer;
106 // begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
107 extern const char *gl_version;
108 // extensions list, space separated
109 extern const char *gl_extensions;
110 // WGL, GLX, or AGL
111 extern const char *gl_platform;
112 // another extensions list, containing platform-specific extensions that are
113 // not in the main list
114 extern const char *gl_platformextensions;
115 // name of driver library (opengl32.dll, libGL.so.1, or whatever)
116 extern char gl_driver[256];
117
118 // compatibility hacks
119 extern qboolean isG200;
120 extern qboolean isRagePro;
121
122 // LordHavoc: GLX_SGI_swap_control and WGL_EXT_swap_control
123 extern int gl_videosyncavailable;
124
125 void *GL_GetProcAddress(const char *name);
126 int GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, const char *disableparm, int silent);
127
128 void VID_Shared_Init(void);
129
130 void GL_Init (void);
131
132 void VID_CheckExtensions(void);
133
134 void VID_Init (void);
135 // Called at startup
136
137 void VID_Shutdown (void);
138 // Called at shutdown
139
140 int VID_SetMode (int modenum);
141 // sets the mode; only used by the Quake engine for resetting to mode 0 (the
142 // base mode) on memory allocation failures
143
144 qboolean VID_InitMode(viddef_mode_t *mode);
145 // allocates and opens an appropriate OpenGL context (and its window)
146
147
148 // sets hardware gamma correction, returns false if the device does not
149 // support gamma control
150 // (ONLY called by VID_UpdateGamma and VID_RestoreSystemGamma)
151 int VID_SetGamma(unsigned short *ramps, int rampsize);
152 // gets hardware gamma correction, returns false if the device does not
153 // support gamma control
154 // (ONLY called by VID_UpdateGamma and VID_RestoreSystemGamma)
155 int VID_GetGamma(unsigned short *ramps, int rampsize);
156 // makes sure ramp arrays are big enough and calls VID_GetGamma/VID_SetGamma
157 // (ONLY to be called from VID_Finish!)
158 void VID_UpdateGamma(qboolean force, int rampsize);
159 // turns off hardware gamma ramps immediately
160 // (called from various shutdown/deactivation functions)
161 void VID_RestoreSystemGamma(void);
162
163 void VID_SetMouse (qboolean fullscreengrab, qboolean relative, qboolean hidecursor);
164 void VID_Finish (void);
165
166 void VID_Restart_f(void);
167
168 void VID_Start(void);
169
170 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
171 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
172 void VID_BuildGammaTables(unsigned short *ramps, int rampsize); // builds the current gamma tables into an array (needs 3*rampsize items)
173
174 typedef struct
175 {
176         int width, height, bpp, refreshrate;
177         int pixelheight_num, pixelheight_denom;
178 }
179 vid_mode_t;
180 size_t VID_ListModes(vid_mode_t *modes, size_t maxcount);
181 size_t VID_SortModes(vid_mode_t *modes, size_t count, qboolean usebpp, qboolean userefreshrate, qboolean useaspect);
182 #endif
183