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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef GLFBDEV_H
#define GLFBDEV_H
/* avoid including linux/fb.h */
struct fb_fix_screeninfo;
struct fb_var_screeninfo;
/* public types */
typedef struct GLFBDevVisualRec *GLFBDevVisualPtr;
typedef struct GLFBDevBufferRec *GLFBDevBufferPtr;
typedef struct GLFBDevContextRec *GLFBDevContextPtr;
/* API version */
#define GLFBDEV_VERSION_1_0 1
/* For glFBDevCreateVisual */
#define GLFBDEV_DOUBLE_BUFFER 100
#define GLFBDEV_COLOR_INDEX 101
#define GLFBDEV_DEPTH_SIZE 102
#define GLFBDEV_STENCIL_SIZE 103
#define GLFBDEV_ACCUM_SIZE 104
#define GLFBDEV_LEVEL 105
#define GLFBDEV_NONE 0
/* For glFBDevGetString */
#define GLFBDEV_VERSION 200
#define GLFBDEV_VENDOR 201
/* Misc functions */
extern const char *
glFBDevGetString( int str );
typedef void (*GLFBDevProc)();
extern GLFBDevProc
glFBDevGetProcAddress( const char *procName );
/**
* Create a GLFBDevVisual.
* \param fixInfo - needed to get the visual types, etc.
* \param varInfo - needed to get the bits_per_pixel, etc.
* \param attribs - for requesting depth, stencil, accum buffers, etc.
*/
extern GLFBDevVisualPtr
glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
const struct fb_var_screeninfo *varInfo,
const int *attribs );
extern void
glFBDevDestroyVisual( GLFBDevVisualPtr visual );
extern int
glFBDevGetVisualAttrib( const GLFBDevVisualPtr visual, int attrib);
/**
* Create a GLFBDevBuffer.
* \param fixInfo, varInfo - needed in order to get the screen size
* (resolution), etc.
* \param visual - as returned by glFBDevCreateVisual()
* \param frontBuffer - address of front color buffer
* \param backBuffer - address of back color buffer (may be NULL)
* \param size - size of the color buffer(s) in bytes.
*/
extern GLFBDevBufferPtr
glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
const struct fb_var_screeninfo *varInfo,
const GLFBDevVisualPtr visual,
void *frontBuffer, void *backBuffer, size_t size );
extern void
glFBDevDestroyBuffer( GLFBDevBufferPtr buffer );
extern int
glFBDevGetBufferAttrib( const GLFBDevBufferPtr buffer, int attrib);
extern GLFBDevBufferPtr
glFBDevGetCurrentDrawBuffer( void );
extern GLFBDevBufferPtr
glFBDevGetCurrentReadBuffer( void );
extern void
glFBDevSwapBuffers( GLFBDevBufferPtr buffer );
/**
* Create a GLFBDevContext.
* \param visual - as created by glFBDevCreateVisual.
* \param share - specifies another context with which to share textures,
* display lists, etc. (may be NULL).
*/
extern GLFBDevContextPtr
glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share );
extern void
glFBDevDestroyContext( GLFBDevContextPtr context );
extern int
glFBDevGetContextAttrib( const GLFBDevContextPtr context, int attrib);
extern GLFBDevContextPtr
glFBDevGetCurrentContext( void );
extern int
glFBDevMakeCurrent( GLFBDevContextPtr context,
GLFBDevBufferPtr drawBuffer,
GLFBDevBufferPtr readBuffer );
#endif /* GLFBDEV_H */
|