-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathgl_framebuffer.h
81 lines (66 loc) · 2.32 KB
/
gl_framebuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Copyright (C) 2011 ezQuake team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GL_FRAMEBUFFER_H__
#define __GL_FRAMEBUFFER_H__
#ifdef FRAMEBUFFERS
// Framebuffer struct.
typedef struct fb_s
{
GLint frame_buffer; // The GL ID of the frame buffer.
GLint depth_buffer; // The GL ID of the depth buffer.
int texture; // The texture ID of the texture we're drawing to.
int depthtex; // The depth texture.
int width; // Width the frame buffer is drawn at.
int height; // Height the frame buffer is drawn at.
int realwidth;
int realheight;
float ratio_h;
float ratio_w;
int x; // X position to draw the frame buffer contents at.
int y; // Y position to draw the frame buffer contents at.
} fb_t;
//
// Initialize framebuffer stuff, Loads procadresses and such.
//
void Framebuffer_Init (void);
//
// Initializes the main frame buffer object, which can be reused
// in several places. Use Framebuffer_Create(...) and create a new
// buffer for specialized use.
//
void Framebuffer_Main_Init(void);
//
// Enable writing to a specified frame buffer object.
// (Instead of drawing to the back buffer)
//
void Framebuffer_Enable (fb_t *fbs);
//
// Disable drawing to a specified frame buffer object.
// (Go back to drawing to the normal back buffer)
//
void Framebuffer_Disable (fb_t *fbs);
//
// Draws the specified frame buffer object onto a polygon
// with the coordinates / bounds specified in it.
//
void Framebuffer_Draw (fb_t *fbs);
//
// Creates a new framebuffer object in GL and adds it's specs
// to the frame buffer struct.
//
void Framebuffer_Create (fb_t *fbs);
extern fb_t main_fb; // The main framebuffer that can be used generally to draw things offscreen.
extern qbool use_framebuffer;
#endif // FRAMEBUFFERS
#endif // __GL_FRAMEBUFFER_H__