[PSDK]
[reactos.git] / dll / 3rdparty / mesa32 / include / GLView.h
1 /*******************************************************************************
2 /
3 / File: GLView.h
4 /
5 / Copyright 1993-98, Be Incorporated, All Rights Reserved.
6 /
7 *******************************************************************************/
8
9 #ifndef BGLVIEW_H
10 #define BGLVIEW_H
11
12 #include <GL/gl.h>
13
14 #define BGL_RGB 0
15 #define BGL_INDEX 1
16 #define BGL_SINGLE 0
17 #define BGL_DOUBLE 2
18 #define BGL_DIRECT 0
19 #define BGL_INDIRECT 4
20 #define BGL_ACCUM 8
21 #define BGL_ALPHA 16
22 #define BGL_DEPTH 32
23 #define BGL_OVERLAY 64
24 #define BGL_UNDERLAY 128
25 #define BGL_STENCIL 512
26
27 #ifdef __cplusplus
28
29
30 #include <AppKit.h>
31 #include <interface/Window.h>
32 #include <interface/View.h>
33 #include <interface/Bitmap.h>
34 #include <game/WindowScreen.h>
35 #include <game/DirectWindow.h>
36
37 class BGLView : public BView {
38 public:
39
40 BGLView(BRect rect, char *name,
41 ulong resizingMode, ulong mode,
42 ulong options);
43 virtual ~BGLView();
44
45 void LockGL();
46 void UnlockGL();
47 void SwapBuffers();
48 void SwapBuffers( bool vSync );
49 BView * EmbeddedView();
50 status_t CopyPixelsOut(BPoint source, BBitmap *dest);
51 status_t CopyPixelsIn(BBitmap *source, BPoint dest);
52 virtual void ErrorCallback(unsigned long errorCode); // Mesa's GLenum is uint where Be's ones was ulong!
53
54 virtual void Draw(BRect updateRect);
55
56 virtual void AttachedToWindow();
57 virtual void AllAttached();
58 virtual void DetachedFromWindow();
59 virtual void AllDetached();
60
61 virtual void FrameResized(float width, float height);
62 virtual status_t Perform(perform_code d, void *arg);
63
64 /* The public methods below, for the moment,
65 are just pass-throughs to BView */
66
67 virtual status_t Archive(BMessage *data, bool deep = true) const;
68
69 virtual void MessageReceived(BMessage *msg);
70 virtual void SetResizingMode(uint32 mode);
71
72 virtual void Show();
73 virtual void Hide();
74
75 virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
76 BMessage *specifier, int32 form,
77 const char *property);
78 virtual status_t GetSupportedSuites(BMessage *data);
79
80 /* New public functions */
81 void DirectConnected( direct_buffer_info *info );
82 void EnableDirectMode( bool enabled );
83
84 void * getGC() { return m_gc; }
85
86 private:
87
88 virtual void _ReservedGLView1();
89 virtual void _ReservedGLView2();
90 virtual void _ReservedGLView3();
91 virtual void _ReservedGLView4();
92 virtual void _ReservedGLView5();
93 virtual void _ReservedGLView6();
94 virtual void _ReservedGLView7();
95 virtual void _ReservedGLView8();
96
97 BGLView(const BGLView &);
98 BGLView &operator=(const BGLView &);
99
100 void dither_front();
101 bool confirm_dither();
102 void draw(BRect r);
103
104 void * m_gc;
105 uint32 m_options;
106 uint32 m_ditherCount;
107 BLocker m_drawLock;
108 BLocker m_displayLock;
109 void * m_clip_info;
110 void * _Unused1;
111
112 BBitmap * m_ditherMap;
113 BRect m_bounds;
114 int16 * m_errorBuffer[2];
115 uint64 _reserved[8];
116
117 /* Direct Window stuff */
118 private:
119 void drawScanline( int x1, int x2, int y, void *data );
120 static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2);
121
122 void lock_draw();
123 void unlock_draw();
124 bool validateView();
125 };
126
127
128
129 class BGLScreen : public BWindowScreen {
130 public:
131 BGLScreen(char *name,
132 ulong screenMode, ulong options,
133 status_t *error, bool debug=false);
134 ~BGLScreen();
135
136 void LockGL();
137 void UnlockGL();
138 void SwapBuffers();
139 virtual void ErrorCallback(GLenum errorCode);
140
141 virtual void ScreenConnected(bool connected);
142 virtual void FrameResized(float width, float height);
143 virtual status_t Perform(perform_code d, void *arg);
144
145 /* The public methods below, for the moment,
146 are just pass-throughs to BWindowScreen */
147
148 virtual status_t Archive(BMessage *data, bool deep = true) const;
149 virtual void MessageReceived(BMessage *msg);
150
151 virtual void Show();
152 virtual void Hide();
153
154 virtual BHandler *ResolveSpecifier(BMessage *msg,
155 int32 index,
156 BMessage *specifier,
157 int32 form,
158 const char *property);
159 virtual status_t GetSupportedSuites(BMessage *data);
160
161 private:
162
163 virtual void _ReservedGLScreen1();
164 virtual void _ReservedGLScreen2();
165 virtual void _ReservedGLScreen3();
166 virtual void _ReservedGLScreen4();
167 virtual void _ReservedGLScreen5();
168 virtual void _ReservedGLScreen6();
169 virtual void _ReservedGLScreen7();
170 virtual void _ReservedGLScreen8();
171
172 BGLScreen(const BGLScreen &);
173 BGLScreen &operator=(const BGLScreen &);
174
175 void * m_gc;
176 long m_options;
177 BLocker m_drawLock;
178
179 int32 m_colorSpace;
180 uint32 m_screen_mode;
181
182 uint64 _reserved[7];
183 };
184
185 #endif // __cplusplus
186
187 #endif // BGLVIEW_H
188
189
190
191
192