]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - vid.h
huge (16%) speed gain on surface rendering by eliminating the surfmesh chain in q1bsp...
[xonotic/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 extern int cl_available;
26
27 typedef struct
28 {
29         // these are set with VID_GetWindowSize and can change from frame to frame
30         int realx;
31         int realy;
32         int realwidth;
33         int realheight;
34
35         int conwidth;
36         int conheight;
37 } viddef_t;
38
39 // global video state
40 extern viddef_t vid;
41 extern void (*vid_menudrawfn)(void);
42 extern void (*vid_menukeyfn)(int key);
43
44 extern int vid_hidden;
45 extern int vid_activewindow;
46 extern int vid_allowhwgamma;
47 extern int vid_hardwaregammasupported;
48 extern int vid_usinghwgamma;
49
50 extern cvar_t vid_fullscreen;
51 extern cvar_t vid_width;
52 extern cvar_t vid_height;
53 extern cvar_t vid_bitsperpixel;
54 extern cvar_t vid_mouse;
55 extern cvar_t vid_stencil;
56
57 extern cvar_t v_gamma;
58 extern cvar_t v_contrast;
59 extern cvar_t v_brightness;
60 extern cvar_t v_color_enable;
61 extern cvar_t v_color_black_r;
62 extern cvar_t v_color_black_g;
63 extern cvar_t v_color_black_b;
64 extern cvar_t v_color_grey_r;
65 extern cvar_t v_color_grey_g;
66 extern cvar_t v_color_grey_b;
67 extern cvar_t v_color_white_r;
68 extern cvar_t v_color_white_g;
69 extern cvar_t v_color_white_b;
70 extern cvar_t v_hwgamma;
71
72 extern int gl_stencil;
73
74 // brand of graphics chip
75 extern const char *gl_vendor;
76 // graphics chip model and other information
77 extern const char *gl_renderer;
78 // begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
79 extern const char *gl_version;
80 // extensions list, space separated
81 extern const char *gl_extensions;
82 // WGL, GLX, or AGL
83 extern const char *gl_platform;
84 // another extensions list, containing platform-specific extensions that are
85 // not in the main list
86 extern const char *gl_platformextensions;
87 // name of driver library (opengl32.dll, libGL.so.1, or whatever)
88 extern char gl_driver[256];
89
90 // compatibility hacks
91 extern qboolean isG200;
92 extern qboolean isRagePro;
93
94 // LordHavoc: GLX_SGI_video_sync and WGL_EXT_swap_control
95 extern int gl_videosyncavailable;
96
97 int GL_OpenLibrary(const char *name);
98 void GL_CloseLibrary(void);
99 void *GL_GetProcAddress(const char *name);
100 int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *disableparm, int silent);
101
102 // this attempts to use vendor extensions to allocate faster vertex memory if
103 // the fast parameter is true, if unsuccessful it uses Mem_Alloc instead
104 void *VID_AllocVertexArrays(mempool_t *pool, int size, int fast, float readfrequency, float writefrequency, float priority);
105 void VID_FreeVertexArrays(void *pointer);
106
107 void VID_Shared_Init(void);
108
109 void GL_Init (void);
110
111 void VID_CheckExtensions(void);
112
113 void VID_Init (void);
114 // Called at startup
115
116 void VID_Shutdown (void);
117 // Called at shutdown
118
119 int VID_SetMode (int modenum);
120 // sets the mode; only used by the Quake engine for resetting to mode 0 (the
121 // base mode) on memory allocation failures
122
123 // sets hardware gamma correction, returns false if the device does not
124 // support gamma control
125 int VID_SetGamma (unsigned short *ramps);
126 // gets hardware gamma correction, returns false if the device does not
127 // support gamma control
128 int VID_GetGamma (unsigned short *ramps);
129
130 void VID_UpdateGamma(qboolean force);
131 void VID_RestoreSystemGamma(void);
132
133 void VID_GetWindowSize (int *x, int *y, int *width, int *height);
134
135 void VID_Finish (void);
136
137 void VID_Restart_f(void);
138
139 void VID_Open (void);
140 void VID_Close (void);
141
142 #endif
143