2008-01-24 15:55:38 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2008, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2005-06-26 17:50:18 +04:00
|
|
|
#ifndef BGLVIEW_H
|
|
|
|
#define BGLVIEW_H
|
|
|
|
|
|
|
|
#include <GL/gl.h>
|
|
|
|
|
|
|
|
#define BGL_RGB 0
|
2008-01-24 15:55:38 +03:00
|
|
|
#define BGL_INDEX 1
|
2005-06-26 17:50:18 +04:00
|
|
|
#define BGL_SINGLE 0
|
|
|
|
#define BGL_DOUBLE 2
|
|
|
|
#define BGL_DIRECT 0
|
|
|
|
#define BGL_INDIRECT 4
|
|
|
|
#define BGL_ACCUM 8
|
|
|
|
#define BGL_ALPHA 16
|
|
|
|
#define BGL_DEPTH 32
|
|
|
|
#define BGL_OVERLAY 64
|
|
|
|
#define BGL_UNDERLAY 128
|
|
|
|
#define BGL_STENCIL 512
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#include <AppKit.h>
|
2008-01-24 15:55:38 +03:00
|
|
|
#include <Bitmap.h>
|
|
|
|
#include <DirectWindow.h>
|
|
|
|
#include <View.h>
|
|
|
|
#include <Window.h>
|
|
|
|
#include <WindowScreen.h>
|
2005-06-26 17:50:18 +04:00
|
|
|
|
2009-08-28 00:25:40 +04:00
|
|
|
struct glview_direct_info;
|
2006-05-10 01:57:42 +04:00
|
|
|
class BGLRenderer;
|
2006-09-07 18:37:31 +04:00
|
|
|
class GLRendererRoster;
|
2006-05-10 01:57:42 +04:00
|
|
|
|
2005-06-26 17:50:18 +04:00
|
|
|
class BGLView : public BView {
|
|
|
|
public:
|
2010-06-27 13:11:17 +04:00
|
|
|
BGLView(BRect rect, const char* name,
|
2005-06-26 17:50:18 +04:00
|
|
|
ulong resizingMode, ulong mode,
|
|
|
|
ulong options);
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual ~BGLView();
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
void LockGL();
|
|
|
|
void UnlockGL();
|
|
|
|
void SwapBuffers();
|
|
|
|
void SwapBuffers(bool vSync);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
BView* EmbeddedView(); // deprecated, returns NULL
|
2010-09-08 14:01:37 +04:00
|
|
|
void* GetGLProcAddress(const char* procName);
|
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
status_t CopyPixelsOut(BPoint source, BBitmap *dest);
|
|
|
|
status_t CopyPixelsIn(BBitmap *source, BPoint dest);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
// Mesa's GLenum is uint where Be's ones was ulong!
|
|
|
|
virtual void ErrorCallback(unsigned long errorCode);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual void Draw(BRect updateRect);
|
|
|
|
virtual void AttachedToWindow();
|
|
|
|
virtual void AllAttached();
|
|
|
|
virtual void DetachedFromWindow();
|
|
|
|
virtual void AllDetached();
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual void FrameResized(float newWidth, float newHeight);
|
|
|
|
virtual status_t Perform(perform_code d, void *arg);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
|
|
|
|
|
|
|
virtual void MessageReceived(BMessage *message);
|
|
|
|
virtual void SetResizingMode(uint32 mode);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual void Show();
|
|
|
|
virtual void Hide();
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index,
|
|
|
|
BMessage *specifier, int32 form,
|
|
|
|
const char *property);
|
2005-06-26 17:50:18 +04:00
|
|
|
virtual status_t GetSupportedSuites(BMessage *data);
|
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
void DirectConnected(direct_buffer_info *info);
|
|
|
|
void EnableDirectMode(bool enabled);
|
2005-06-26 17:50:18 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
void* getGC() { return fGc; } // ???
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2010-03-11 02:03:03 +03:00
|
|
|
virtual void GetPreferredSize(float* width, float* height);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
|
|
|
|
2005-06-26 17:50:18 +04:00
|
|
|
private:
|
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
virtual void _ReservedGLView1();
|
2010-09-08 14:01:37 +04:00
|
|
|
virtual void _ReservedGLView2();
|
|
|
|
virtual void _ReservedGLView3();
|
|
|
|
virtual void _ReservedGLView4();
|
|
|
|
virtual void _ReservedGLView5();
|
|
|
|
virtual void _ReservedGLView6();
|
|
|
|
virtual void _ReservedGLView7();
|
|
|
|
virtual void _ReservedGLView8();
|
|
|
|
|
2005-06-26 17:50:18 +04:00
|
|
|
BGLView(const BGLView &);
|
2008-01-24 15:55:38 +03:00
|
|
|
BGLView &operator=(const BGLView &);
|
2005-06-26 17:50:18 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
void _DitherFront();
|
|
|
|
bool _ConfirmDither();
|
|
|
|
void _Draw(BRect rect);
|
2009-07-05 21:56:33 +04:00
|
|
|
void _CallDirectConnected();
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
void * fGc;
|
|
|
|
uint32 fOptions;
|
|
|
|
uint32 fDitherCount;
|
|
|
|
BLocker fDrawLock;
|
|
|
|
BLocker fDisplayLock;
|
2009-08-28 00:25:40 +04:00
|
|
|
glview_direct_info * fClipInfo;
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2006-09-07 18:37:31 +04:00
|
|
|
BGLRenderer *fRenderer;
|
|
|
|
GLRendererRoster *fRoster;
|
2005-06-26 17:50:18 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
BBitmap * fDitherMap;
|
|
|
|
BRect fBounds;
|
|
|
|
int16 * fErrorBuffer[2];
|
2005-06-26 17:50:18 +04:00
|
|
|
uint64 _reserved[8];
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
void _LockDraw();
|
|
|
|
void _UnlockDraw();
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2010-06-29 02:16:07 +04:00
|
|
|
// BeOS compatibility
|
|
|
|
private:
|
|
|
|
BGLView(BRect rect, char* name,
|
|
|
|
ulong resizingMode, ulong mode,
|
|
|
|
ulong options);
|
2005-06-26 17:50:18 +04:00
|
|
|
};
|
|
|
|
|
2008-01-24 16:05:21 +03:00
|
|
|
|
|
|
|
class BGLScreen : public BWindowScreen {
|
|
|
|
public:
|
2009-08-12 18:39:26 +04:00
|
|
|
BGLScreen(char* name,
|
2008-01-24 16:05:21 +03:00
|
|
|
ulong screenMode, ulong options,
|
|
|
|
status_t *error, bool debug=false);
|
|
|
|
~BGLScreen();
|
|
|
|
|
|
|
|
void LockGL();
|
|
|
|
void UnlockGL();
|
|
|
|
void SwapBuffers();
|
|
|
|
// Mesa's GLenum is uint where Be's ones was ulong!
|
|
|
|
virtual void ErrorCallback(unsigned long errorCode);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 16:05:21 +03:00
|
|
|
virtual void ScreenConnected(bool connected);
|
|
|
|
virtual void FrameResized(float width, float height);
|
|
|
|
virtual status_t Perform(perform_code code, void *arg);
|
|
|
|
|
|
|
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
|
|
|
virtual void MessageReceived(BMessage *message);
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 16:05:21 +03:00
|
|
|
virtual void Show();
|
|
|
|
virtual void Hide();
|
|
|
|
|
|
|
|
virtual BHandler* ResolveSpecifier(BMessage *message,
|
|
|
|
int32 index,
|
|
|
|
BMessage *specifier,
|
|
|
|
int32 form,
|
|
|
|
const char *property);
|
|
|
|
virtual status_t GetSupportedSuites(BMessage *data);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
virtual void _ReservedGLScreen1();
|
|
|
|
virtual void _ReservedGLScreen2();
|
|
|
|
virtual void _ReservedGLScreen3();
|
|
|
|
virtual void _ReservedGLScreen4();
|
|
|
|
virtual void _ReservedGLScreen5();
|
|
|
|
virtual void _ReservedGLScreen6();
|
|
|
|
virtual void _ReservedGLScreen7();
|
2010-09-08 14:01:37 +04:00
|
|
|
virtual void _ReservedGLScreen8();
|
2008-01-24 16:05:21 +03:00
|
|
|
|
|
|
|
BGLScreen(const BGLScreen &);
|
|
|
|
BGLScreen &operator=(const BGLScreen &);
|
|
|
|
|
|
|
|
void * fGc;
|
|
|
|
long fOptions;
|
|
|
|
BLocker fDrawLock;
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 16:05:21 +03:00
|
|
|
int32 fColorSpace;
|
|
|
|
uint32 fScreenMode;
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 16:05:21 +03:00
|
|
|
uint64 _reserved[7];
|
|
|
|
};
|
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
#endif // __cplusplus
|
2010-09-08 14:01:37 +04:00
|
|
|
|
2008-01-24 15:55:38 +03:00
|
|
|
#endif // BGLVIEW_H
|