Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/include/HaikuGL/GLView.h
4558 views
1
/*
2
* Copyright 2008-2013, Haiku, Inc. All Rights Reserved.
3
* Distributed under the terms of the MIT License.
4
*
5
* This header defines BGLView, the base class making up
6
* the Haiku GL Kit.
7
*
8
*/
9
#ifndef BGLVIEW_H
10
#define BGLVIEW_H
11
12
13
#include <GL/gl.h>
14
15
#define BGL_RGB 0
16
#define BGL_INDEX 1
17
#define BGL_SINGLE 0
18
#define BGL_DOUBLE 2
19
#define BGL_DIRECT 0
20
#define BGL_INDIRECT 4
21
#define BGL_ACCUM 8
22
#define BGL_ALPHA 16
23
#define BGL_DEPTH 32
24
#define BGL_OVERLAY 64
25
#define BGL_UNDERLAY 128
26
#define BGL_STENCIL 512
27
#define BGL_SHARE_CONTEXT 1024
28
29
#ifdef __cplusplus
30
31
#include <AppKit.h>
32
#include <Bitmap.h>
33
#include <DirectWindow.h>
34
#include <View.h>
35
#include <Window.h>
36
#include <WindowScreen.h>
37
38
39
struct glview_direct_info;
40
class BGLRenderer;
41
class GLRendererRoster;
42
43
class _EXPORT BGLView : public BView {
44
public:
45
BGLView(BRect rect, const char* name,
46
ulong resizingMode, ulong mode,
47
ulong options);
48
virtual ~BGLView();
49
50
void LockGL();
51
void UnlockGL();
52
void SwapBuffers();
53
void SwapBuffers(bool vSync);
54
55
BView* EmbeddedView(); // deprecated, returns NULL
56
void* GetGLProcAddress(const char* procName);
57
58
status_t CopyPixelsOut(BPoint source, BBitmap *dest);
59
status_t CopyPixelsIn(BBitmap *source, BPoint dest);
60
61
// Mesa's GLenum is uint where Be's ones was ulong!
62
virtual void ErrorCallback(unsigned long errorCode);
63
64
virtual void Draw(BRect updateRect);
65
virtual void AttachedToWindow();
66
virtual void AllAttached();
67
virtual void DetachedFromWindow();
68
virtual void AllDetached();
69
70
virtual void FrameResized(float newWidth, float newHeight);
71
virtual status_t Perform(perform_code d, void *arg);
72
73
virtual status_t Archive(BMessage *data, bool deep = true) const;
74
75
virtual void MessageReceived(BMessage *message);
76
virtual void SetResizingMode(uint32 mode);
77
78
virtual void Show();
79
virtual void Hide();
80
81
virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index,
82
BMessage *specifier, int32 form,
83
const char *property);
84
virtual status_t GetSupportedSuites(BMessage *data);
85
86
void DirectConnected(direct_buffer_info *info);
87
void EnableDirectMode(bool enabled);
88
89
void* getGC() { return fGc; } // ???
90
91
virtual void GetPreferredSize(float* width, float* height);
92
93
private:
94
95
virtual void _ReservedGLView1();
96
virtual void _ReservedGLView2();
97
virtual void _ReservedGLView3();
98
virtual void _ReservedGLView4();
99
virtual void _ReservedGLView5();
100
virtual void _ReservedGLView6();
101
virtual void _ReservedGLView7();
102
virtual void _ReservedGLView8();
103
104
BGLView(const BGLView &);
105
BGLView &operator=(const BGLView &);
106
107
void _DitherFront();
108
bool _ConfirmDither();
109
void _Draw(BRect rect);
110
void _CallDirectConnected();
111
112
void* fGc;
113
uint32 fOptions;
114
uint32 fDitherCount;
115
BLocker fDrawLock;
116
BLocker fDisplayLock;
117
glview_direct_info* fClipInfo;
118
119
BGLRenderer* fRenderer;
120
GLRendererRoster* fRoster;
121
122
BBitmap* fDitherMap;
123
BRect fBounds;
124
int16* fErrorBuffer[2];
125
uint64 _reserved[8];
126
127
void _LockDraw();
128
void _UnlockDraw();
129
130
// BeOS compatibility
131
private:
132
BGLView(BRect rect, char* name,
133
ulong resizingMode, ulong mode,
134
ulong options);
135
};
136
137
138
class BGLScreen : public BWindowScreen {
139
public:
140
BGLScreen(char* name,
141
ulong screenMode, ulong options,
142
status_t *error, bool debug=false);
143
~BGLScreen();
144
145
void LockGL();
146
void UnlockGL();
147
void SwapBuffers();
148
// Mesa's GLenum is uint where Be's ones was ulong!
149
virtual void ErrorCallback(unsigned long errorCode);
150
151
virtual void ScreenConnected(bool connected);
152
virtual void FrameResized(float width, float height);
153
virtual status_t Perform(perform_code code, void *arg);
154
155
virtual status_t Archive(BMessage *data, bool deep = true) const;
156
virtual void MessageReceived(BMessage *message);
157
158
virtual void Show();
159
virtual void Hide();
160
161
virtual BHandler* ResolveSpecifier(BMessage *message,
162
int32 index,
163
BMessage *specifier,
164
int32 form,
165
const char *property);
166
virtual status_t GetSupportedSuites(BMessage *data);
167
168
private:
169
170
virtual void _ReservedGLScreen1();
171
virtual void _ReservedGLScreen2();
172
virtual void _ReservedGLScreen3();
173
virtual void _ReservedGLScreen4();
174
virtual void _ReservedGLScreen5();
175
virtual void _ReservedGLScreen6();
176
virtual void _ReservedGLScreen7();
177
virtual void _ReservedGLScreen8();
178
179
BGLScreen(const BGLScreen &);
180
BGLScreen &operator=(const BGLScreen &);
181
182
void* fGc;
183
long fOptions;
184
BLocker fDrawLock;
185
186
int32 fColorSpace;
187
uint32 fScreenMode;
188
189
uint64 _reserved[7];
190
};
191
192
#endif // __cplusplus
193
194
#endif // BGLVIEW_H
195
196