DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
vid.h
Go to the documentation of this file.
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 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#include <stddef.h>
26#include "qtypes.h"
27struct cmd_state_s;
28
29#define ENGINE_ICON ( (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm )
30
31extern int cl_available;
32
33#define MAX_TEXTUREUNITS 32
34
35typedef enum renderpath_e
36{
41
54
68
69typedef struct viddef_s
70{
71 // these are set by VID_Mode
72 // used in many locations in the renderer
79
82
83 unsigned int maxtexturesize_2d;
84 unsigned int maxtexturesize_3d;
86 unsigned int max_anisotropy;
87 unsigned int maxdrawbuffers;
88
90
92
93 int xPos, yPos;
94} viddef_t;
95
97extern viddef_t vid;
98
99#define MAXJOYAXIS 16
100// if this is changed, the corresponding code in vid_shared.c must be updated
101#define MAXJOYBUTTON 36
102typedef struct vid_joystate_s
103{
104 float axis[MAXJOYAXIS];
105 unsigned char button[MAXJOYBUTTON];
107}
109
111
112extern cvar_t joy_index;
113extern cvar_t joy_enable;
114extern cvar_t joy_detected;
115extern cvar_t joy_active;
116
117float VID_JoyState_GetAxis(const vid_joystate_t *joystate, int axis, float sensitivity, float deadzone);
118void VID_ApplyJoyState(vid_joystate_t *joystate);
119void VID_BuildJoyState(vid_joystate_t *joystate);
124void VID_EnableJoystick(qbool enable);
125
127extern qbool scr_loading;
128
129extern qbool vid_hidden;
132
135extern cvar_t vid_width;
136extern cvar_t vid_height;
138extern cvar_t vid_samples;
143extern cvar_t vid_vsync;
144extern cvar_t vid_mouse;
152extern cvar_t vid_resizable;
154extern cvar_t vid_display;
156#ifdef WIN32
157extern cvar_t vid_ignore_taskbar;
158#endif
159extern cvar_t vid_minwidth;
160extern cvar_t vid_minheight;
161extern cvar_t vid_sRGB;
163
164extern cvar_t gl_finish;
165
166extern cvar_t v_gamma;
167extern cvar_t v_contrast;
168extern cvar_t v_brightness;
179
185
187extern const char *gl_vendor;
189extern const char *gl_renderer;
191extern const char *gl_version;
192
193
194void *GL_GetProcAddress(const char *name);
195qbool GL_CheckExtension(const char *name, const char *disableparm, int silent);
196qbool GL_ExtensionSupported(const char *name);
197
198void VID_Shared_Init(void);
199
200void GL_InitFunctions(void);
201void GL_Setup(void);
202
203void VID_ClearExtensions(void);
204
206void VID_Init (void);
207
209void VID_Shutdown (void);
210
213int VID_SetMode (int modenum);
214
217
218
221void VID_UpdateGamma(void);
222
224void VID_ShowKeyboard(qbool show);
226
227void VID_Finish (void);
228
229void VID_Restart_f(struct cmd_state_s *cmd);
230
231void VID_Start(void);
232void VID_Stop(void);
233
234extern unsigned int vid_gammatables_serial;
237void VID_BuildGammaTables(unsigned short *ramps, int rampsize);
239void VID_ApplyGammaToColor(const float *rgb, float *out);
240
241typedef struct
242{
243 int width, height, bpp, refreshrate;
244 int pixelheight_num, pixelheight_denom;
245}
248size_t VID_ListModes(vid_mode_t *modes, size_t maxcount);
249size_t VID_SortModes(vid_mode_t *modes, size_t count, qbool usebpp, qbool userefreshrate, qbool useaspect);
251
252#endif
253
cvar_t sensitivity
Definition cl_main.c:53
static glmode_t modes[6]
GLenum GLsizei width
Definition glquake.h:622
GLenum GLsizei GLsizei height
Definition glquake.h:622
GLenum mode
Definition glquake.h:718
GLenum GLenum GLsizei count
Definition glquake.h:656
const GLchar * name
Definition glquake.h:601
GLuint index
Definition glquake.h:629
void cmd(string command,...)
bool qbool
Definition qtypes.h:9
dp_FragColor rgb
Definition cvar.h:66
qbool is360
indicates this joystick is a Microsoft Xbox 360 Controller For Windows
Definition vid.h:106
int pixelheight_denom
Definition vid.h:244
int bpp
Definition vid.h:243
int samples
Definition vid.h:65
qbool desktopfullscreen
whether the display hardware mode can be changed
Definition vid.h:59
qbool stereobuffer
Definition vid.h:64
float refreshrate
Definition vid.h:63
int width
Definition vid.h:60
int height
Definition vid.h:61
qbool fullscreen
Definition vid.h:58
int bitsperpixel
Definition vid.h:62
int display
Definition vid.h:57
qbool ext_texture_filter_anisotropic
Definition vid.h:49
qbool amd_texture_texture4
Definition vid.h:46
qbool arb_texture_gather
Definition vid.h:47
qbool ext_texture_compression_s3tc
Definition vid.h:48
qbool ext_texture_srgb
Definition vid.h:50
int glversion
this is at least 32
Definition vid.h:44
qbool arb_debug_output
Definition vid.h:51
int glshaderversion
this is at least 150 (GL 3.2)
Definition vid.h:45
Definition vid.h:70
unsigned int maxtexturesize_2d
Definition vid.h:83
qbool sRGB3D
whether 3D rendering is sRGB corrected (based on sRGBcapable3D)
Definition vid.h:76
int forcetextype
always use GL_BGRA for D3D, always use GL_RGBA for GLES, etc
Definition vid.h:91
unsigned int maxtexturesize_3d
Definition vid.h:84
unsigned int maxtexturesize_cubemap
Definition vid.h:85
int xPos
Definition vid.h:93
qbool sRGB2D
whether 2D rendering is sRGB corrected (based on sRGBcapable2D)
Definition vid.h:75
renderpath_t renderpath
Definition vid.h:80
qbool stencil
Definition vid.h:74
qbool sRGBcapable3D
whether 3D rendering can be sRGB corrected (renderpath)
Definition vid.h:78
unsigned int max_anisotropy
Definition vid.h:86
viddef_support_t support
Definition vid.h:89
viddef_mode_t mode
currently active video mode
Definition vid.h:73
qbool allowalphatocoverage
indicates the GL_AlphaToCoverage function works on this renderpath and framebuffer
Definition vid.h:81
unsigned int maxdrawbuffers
Definition vid.h:87
qbool sRGBcapable2D
whether 2D rendering can be sRGB corrected (renderpath)
Definition vid.h:77
cvar_t vid_refreshrate
Definition vid_shared.c:140
cvar_t v_color_enable
Definition vid_shared.c:176
cvar_t vid_width
Definition vid_shared.c:136
qbool GL_ExtensionSupported(const char *name)
Definition vid_null.c:67
const char * gl_vendor
brand of graphics chip
Definition vid_shared.c:190
cvar_t vid_sRGB_fallback
Definition vid_shared.c:158
void VID_EnableJoystick(qbool enable)
Definition vid_sdl.c:1583
cvar_t vid_minimize_on_focus_loss
Definition vid_shared.c:152
void VID_Shared_Init(void)
void GL_Setup(void)
Definition vid_shared.c:712
void VID_Shared_BuildJoyState_Finish(vid_joystate_t *joystate)
Definition vid_shared.c:929
cvar_t v_color_white_b
Definition vid_shared.c:185
int cl_available
Definition vid_null.c:24
cvar_t vid_minwidth
Definition vid_shared.c:154
void VID_Start(void)
cvar_t joy_active
Definition vid_shared.c:84
qbool VID_HasScreenKeyboardSupport(void)
Definition vid_sdl.c:338
cvar_t gl_info_extensions
Definition vid_shared.c:131
cvar_t vid_stick_mouse
Definition vid_shared.c:163
qbool vid_gammatables_trivial
this is set to true if all color control values are at default setting, and it therefore would make n...
void VID_ApplyGammaToColor(const float *rgb, float *out)
applies current gamma settings to a color (0-1 range)
cvar_t vid_display
Definition vid_shared.c:166
cvar_t gl_info_version
Definition vid_shared.c:130
cvar_t vid_height
Definition vid_shared.c:137
cvar_t vid_vsync
Definition vid_shared.c:149
cvar_t joy_detected
Definition vid_shared.c:85
float VID_JoyState_GetAxis(const vid_joystate_t *joystate, int axis, float sensitivity, float deadzone)
Definition vid_shared.c:854
qbool vid_supportrefreshrate
Definition vid_null.c:26
cvar_t vid_touchscreen_ydpi
Definition vid_shared.c:147
cvar_t v_color_grey_b
Definition vid_shared.c:182
cvar_t v_gamma
Definition vid_shared.c:172
int VID_SetMode(int modenum)
sets the mode; only used by the Quake engine for resetting to mode 0 (the base mode) on memory alloca...
#define MAXJOYAXIS
Definition vid.h:99
unsigned int vid_gammatables_serial
so other subsystems can poll if gamma parameters have changed; this starts with 0 and gets increased ...
cvar_t vid_grabkeyboard
Definition vid_shared.c:153
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
Definition vid_null.c:62
renderpath_t
Definition vid.h:36
@ RENDERPATH_GLES2
Definition vid.h:38
@ RENDERPATH_GL32
Definition vid.h:37
qbool VID_JoyBlockEmulatedKeys(int keycode)
Definition vid_shared.c:864
void VID_Stop(void)
void VID_Finish(void)
Definition vid_null.c:32
void GL_InitFunctions(void)
Definition vid_shared.c:684
cvar_t gl_info_renderer
Definition vid_shared.c:129
cvar_t vid_info_displaycount
Definition vid_shared.c:167
vid_joystate_t vid_joystate
Definition vid_shared.c:79
cvar_t vid_touchscreen_xdpi
Definition vid_shared.c:146
void VID_Init(void)
Called at startup.
Definition vid_null.c:36
cvar_t vid_borderless
Definition vid_shared.c:135
cvar_t vid_touchscreen_density
Definition vid_shared.c:145
cvar_t v_color_white_g
Definition vid_shared.c:184
vid_mode_t VID_GetDesktopMode(void)
Definition vid_sdl.c:1895
cvar_t vid_touchscreen_showkeyboard
Definition vid_shared.c:161
cvar_t cl_demo_mousegrab
Definition cl_screen.c:92
cvar_t vid_sRGB
Definition vid_shared.c:157
const char * gl_version
begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
Definition vid_shared.c:194
qbool VID_InitMode(const viddef_mode_t *mode)
allocates and opens an appropriate OpenGL context (and its window)
Definition vid_null.c:40
void * GL_GetProcAddress(const char *name)
Definition vid_null.c:45
qbool VID_ShowingKeyboard(void)
Definition vid_sdl.c:360
cvar_t v_color_black_r
Definition vid_shared.c:177
cvar_t vid_mouse_clickthrough
Definition vid_shared.c:151
cvar_t v_color_black_b
Definition vid_shared.c:179
cvar_t gl_info_driver
Definition vid_shared.c:132
void VID_Shutdown(void)
Called at shutdown.
Definition vid_null.c:28
cvar_t joy_enable
Definition vid_shared.c:86
cvar_t v_color_black_g
Definition vid_shared.c:178
const char * gl_renderer
graphics chip model and other information
Definition vid_shared.c:192
void VID_ApplyJoyState(vid_joystate_t *joystate)
cvar_t vid_mouse
Definition vid_shared.c:150
viddef_t vid
global video state
Definition vid_shared.c:64
qbool GL_CheckExtension(const char *name, const char *disableparm, int silent)
Definition vid_shared.c:633
cvar_t v_color_grey_g
Definition vid_shared.c:181
cvar_t vid_samples
Definition vid_shared.c:139
void VID_UpdateGamma(void)
updates cachegamma variables and bumps vid_gammatables_serial if anything changed (ONLY to be called ...
void VID_Shared_BuildJoyState_Begin(vid_joystate_t *joystate)
Definition vid_shared.c:885
void VID_ClearExtensions(void)
Definition vid_shared.c:675
cvar_t vid_desktopfullscreen
Definition vid_shared.c:165
cvar_t joy_index
Definition vid_shared.c:87
cvar_t vid_resizable
Definition vid_shared.c:164
void VID_Soft_SharedSetup(void)
cvar_t v_brightness
Definition vid_shared.c:174
cvar_t v_color_white_r
Definition vid_shared.c:183
void VID_BuildGammaTables(unsigned short *ramps, int rampsize)
builds the current gamma tables into an array (needs 3*rampsize items)
size_t VID_SortModes(vid_mode_t *modes, size_t count, qbool usebpp, qbool userefreshrate, qbool useaspect)
#define MAXJOYBUTTON
Definition vid.h:101
void VID_ShowKeyboard(qbool show)
Definition vid_sdl.c:343
cvar_t gl_finish
Definition vid_shared.c:156
cvar_t vid_touchscreen_supportshowkeyboard
Definition vid_shared.c:162
qbool vid_hidden
Definition vid_shared.c:74
cvar_t v_color_grey_r
Definition vid_shared.c:180
qbool vid_activewindow
Definition vid_shared.c:77
void VID_Restart_f(struct cmd_state_s *cmd)
cvar_t vid_bitsperpixel
Definition vid_shared.c:138
cvar_t vid_touchscreen
Definition vid_shared.c:160
qbool scr_loading
Definition cl_screen.c:104
cvar_t vid_minheight
Definition vid_shared.c:155
cvar_t gl_info_vendor
Definition vid_shared.c:128
void VID_BuildJoyState(vid_joystate_t *joystate)
Definition vid_null.c:54
cvar_t v_contrast
Definition vid_shared.c:173
int VID_Shared_SetJoystick(int index)
cvar_t vid_fullscreen
Definition vid_shared.c:134