1 /*******************************************************************************
5 / Copyright 1993-98, Be Incorporated, All Rights Reserved.
7 *******************************************************************************/
12 // added by Brian Paul:
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
,
49 // Added for Mesa (can't be virtual!)
50 void CopySubBufferMESA(GLint x
, GLint y
, GLuint width
, GLuint height
);
52 BView
* EmbeddedView();
53 status_t
CopyPixelsOut(BPoint source
, BBitmap
*dest
);
54 status_t
CopyPixelsIn(BBitmap
*source
, BPoint dest
);
56 virtual void ErrorCallback(unsigned long errorCode
); // GLenum errorCode);
58 virtual void Draw(BRect updateRect
);
60 virtual void AttachedToWindow();
61 virtual void AllAttached();
62 virtual void DetachedFromWindow();
63 virtual void AllDetached();
65 virtual void FrameResized(float width
, float height
);
66 virtual status_t
Perform(perform_code d
, void *arg
);
68 /* The public methods below, for the moment,
69 are just pass-throughs to BView */
71 virtual status_t
Archive(BMessage
*data
, bool deep
= true) const;
73 virtual void MessageReceived(BMessage
*msg
);
74 virtual void SetResizingMode(uint32 mode
);
79 virtual BHandler
*ResolveSpecifier(BMessage
*msg
, int32 index
,
80 BMessage
*specifier
, int32 form
,
81 const char *property
);
82 virtual status_t
GetSupportedSuites(BMessage
*data
);
84 /* New public functions */
85 void DirectConnected( direct_buffer_info
*info
);
86 void EnableDirectMode( bool enabled
);
90 virtual void _ReservedGLView1();
91 virtual void _ReservedGLView2();
92 virtual void _ReservedGLView3();
93 virtual void _ReservedGLView4();
94 virtual void _ReservedGLView5();
95 virtual void _ReservedGLView6();
96 virtual void _ReservedGLView7();
97 virtual void _ReservedGLView8();
99 BGLView(const BGLView
&);
100 BGLView
&operator=(const BGLView
&);
103 bool confirm_dither();
108 uint32 m_ditherCount
;
110 BLocker m_displayLock
;
112 BView
* m_embeddedFront
;
113 BView
* m_embeddedBack
;
118 BBitmap
* m_ditherMap
;
120 int16
* m_errorBuffer
[2];
123 /* Direct Window stuff */
125 void drawScanline( int x1
, int x2
, int y
, void *data
);
126 static void scanlineHandler(struct rasStateRec
*state
, GLint x1
, GLint x2
);
134 class BGLScreen
: public BWindowScreen
{
136 BGLScreen(char *name
,
137 ulong screenMode
, ulong options
,
138 status_t
*error
, bool debug
=false);
144 virtual void ErrorCallback(GLenum errorCode
);
146 virtual void ScreenConnected(bool connected
);
147 virtual void FrameResized(float width
, float height
);
148 virtual status_t
Perform(perform_code d
, void *arg
);
150 /* The public methods below, for the moment,
151 are just pass-throughs to BWindowScreen */
153 virtual status_t
Archive(BMessage
*data
, bool deep
= true) const;
154 virtual void MessageReceived(BMessage
*msg
);
159 virtual BHandler
*ResolveSpecifier(BMessage
*msg
,
163 const char *property
);
164 virtual status_t
GetSupportedSuites(BMessage
*data
);
168 virtual void _ReservedGLScreen1();
169 virtual void _ReservedGLScreen2();
170 virtual void _ReservedGLScreen3();
171 virtual void _ReservedGLScreen4();
172 virtual void _ReservedGLScreen5();
173 virtual void _ReservedGLScreen6();
174 virtual void _ReservedGLScreen7();
175 virtual void _ReservedGLScreen8();
177 BGLScreen(const BGLScreen
&);
178 BGLScreen
&operator=(const BGLScreen
&);
185 uint32 m_screen_mode
;