1 | #ifndef _glview_h_ |
---|
2 | #define _glview_h_ |
---|
3 | |
---|
4 | #define BGL_RGB 0 |
---|
5 | #define BGL_INDEX 1 |
---|
6 | #define BGL_SINGLE 0 |
---|
7 | #define BGL_DOUBLE 2 |
---|
8 | #define BGL_DIRECT 0 |
---|
9 | #define BGL_INDIRECT 4 |
---|
10 | #define BGL_ACCUM 8 |
---|
11 | #define BGL_ALPHA 16 |
---|
12 | #define BGL_DEPTH 32 |
---|
13 | #define BGL_OVERLAY 64 |
---|
14 | #define BGL_UNDERLAY 128 |
---|
15 | #define BGL_STENCIL 512 |
---|
16 | |
---|
17 | #include <interface/View.h> |
---|
18 | #include <support/Locker.h> |
---|
19 | #include <GL/gl.h> |
---|
20 | #include <GL/oscontext.h> |
---|
21 | #include <game/WindowScreen.h> |
---|
22 | #include <game/DirectWindow.h> |
---|
23 | |
---|
24 | class BGLView : public BView { |
---|
25 | public: |
---|
26 | BGLView(BRect rect, char *name, |
---|
27 | ulong resizingMode, ulong mode, |
---|
28 | ulong options); |
---|
29 | virtual ~BGLView(); |
---|
30 | |
---|
31 | void LockGL(); |
---|
32 | void UnlockGL(); |
---|
33 | void SwapBuffers(); |
---|
34 | // BView *EmbeddedView(); |
---|
35 | // status_t CopyPixelsOut(BPoint source, BBitmap *dest); |
---|
36 | // status_t CopyPixelsIn(BBitmap *source, BPoint dest); |
---|
37 | |
---|
38 | virtual void ErrorCallback(GLenum errorCode); |
---|
39 | virtual void Draw(BRect updateRect); |
---|
40 | virtual void AttachedToWindow(); |
---|
41 | virtual void AllAttached(); |
---|
42 | virtual void DetachedFromWindow(); |
---|
43 | virtual void AllDetached(); |
---|
44 | virtual void FrameResized(float width, float height); |
---|
45 | // virtual status_t Perform(perform_code d, void *arg); |
---|
46 | |
---|
47 | // |
---|
48 | // Methods below are pass-throughs to BView for the moment. |
---|
49 | // |
---|
50 | |
---|
51 | virtual status_t Archive(BMessage *data, bool deep = true) const; |
---|
52 | virtual void MessageReceived(BMessage *msg); |
---|
53 | virtual void SetResizingMode(uint32 mode); |
---|
54 | |
---|
55 | virtual void Show(); |
---|
56 | virtual void Hide(); |
---|
57 | |
---|
58 | virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index, |
---|
59 | BMessage *specifier, int32 form, |
---|
60 | const char *property); |
---|
61 | virtual status_t GetSupportedSuites(BMessage *data); |
---|
62 | //void DirectConnected( direct_buffer_info *info ); |
---|
63 | //void EnableDirectMode( bool enabled ); |
---|
64 | |
---|
65 | private: |
---|
66 | ostgl_context *context; |
---|
67 | BBitmap *bitmaps[2]; |
---|
68 | int currBitmap; |
---|
69 | static BLocker locker; |
---|
70 | }; |
---|
71 | |
---|
72 | #endif // _glview_h_ |
---|