1 /*******************************************************************************
5 / Copyright 1993-98, Be Incorporated, All Rights Reserved.
7 *******************************************************************************/
19 #define BGL_INDIRECT 4
23 #define BGL_OVERLAY 64
24 #define BGL_UNDERLAY 128
25 #define BGL_STENCIL 512
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>
37 class BGLView : public BView {
40 BGLView(BRect rect, char *name,
41 ulong resizingMode, ulong mode,
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!
54 virtual void Draw(BRect updateRect);
56 virtual void AttachedToWindow();
57 virtual void AllAttached();
58 virtual void DetachedFromWindow();
59 virtual void AllDetached();
61 virtual void FrameResized(float width, float height);
62 virtual status_t Perform(perform_code d, void *arg);
64 /* The public methods below, for the moment,
65 are just pass-throughs to BView */
67 virtual status_t Archive(BMessage *data, bool deep = true) const;
69 virtual void MessageReceived(BMessage *msg);
70 virtual void SetResizingMode(uint32 mode);
75 virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
76 BMessage *specifier, int32 form,
77 const char *property);
78 virtual status_t GetSupportedSuites(BMessage *data);
80 /* New public functions */
81 void DirectConnected( direct_buffer_info *info );
82 void EnableDirectMode( bool enabled );
84 void * getGC() { return m_gc; }
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();
97 BGLView(const BGLView &);
98 BGLView &operator=(const BGLView &);
101 bool confirm_dither();
106 uint32 m_ditherCount;
108 BLocker m_displayLock;
112 BBitmap * m_ditherMap;
114 int16 * m_errorBuffer[2];
117 /* Direct Window stuff */
119 void drawScanline( int x1, int x2, int y, void *data );
120 static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2);
129 class BGLScreen : public BWindowScreen {
131 BGLScreen(char *name,
132 ulong screenMode, ulong options,
133 status_t *error, bool debug=false);
139 virtual void ErrorCallback(GLenum errorCode);
141 virtual void ScreenConnected(bool connected);
142 virtual void FrameResized(float width, float height);
143 virtual status_t Perform(perform_code d, void *arg);
145 /* The public methods below, for the moment,
146 are just pass-throughs to BWindowScreen */
148 virtual status_t Archive(BMessage *data, bool deep = true) const;
149 virtual void MessageReceived(BMessage *msg);
154 virtual BHandler *ResolveSpecifier(BMessage *msg,
158 const char *property);
159 virtual status_t GetSupportedSuites(BMessage *data);
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();
172 BGLScreen(const BGLScreen &);
173 BGLScreen &operator=(const BGLScreen &);
180 uint32 m_screen_mode;
185 #endif // __cplusplus