2006-09-05 20:00:15 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2006, Philippe Houdoin. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2005-06-27 00:21:09 +04:00
|
|
|
#ifndef GLRENDERER_H
|
|
|
|
#define GLRENDERER_H
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
2006-05-10 01:56:08 +04:00
|
|
|
#include <GLView.h>
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2006-05-10 01:56:08 +04:00
|
|
|
class BGLDispatcher;
|
2006-09-07 11:47:22 +04:00
|
|
|
class GLRendererRoster;
|
|
|
|
|
|
|
|
typedef unsigned long renderer_id;
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2006-05-10 01:56:08 +04:00
|
|
|
class BGLRenderer
|
2005-06-27 00:21:09 +04:00
|
|
|
{
|
2006-05-10 01:56:08 +04:00
|
|
|
|
2005-06-27 00:21:09 +04:00
|
|
|
// Private unimplemented copy constructors
|
2010-02-09 01:50:38 +03:00
|
|
|
BGLRenderer(const BGLRenderer &);
|
|
|
|
BGLRenderer & operator=(const BGLRenderer &);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
|
|
|
public:
|
2010-02-09 01:50:38 +03:00
|
|
|
BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
|
|
|
|
virtual ~BGLRenderer();
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2010-02-09 01:50:38 +03:00
|
|
|
void Acquire();
|
|
|
|
void Release();
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2006-09-08 01:13:53 +04:00
|
|
|
virtual void LockGL();
|
|
|
|
virtual void UnlockGL();
|
2006-05-10 01:56:08 +04:00
|
|
|
|
2006-09-05 20:00:15 +04:00
|
|
|
virtual void SwapBuffers(bool VSync = false);
|
2006-05-10 01:56:08 +04:00
|
|
|
virtual void Draw(BRect updateRect);
|
2010-02-09 01:50:38 +03:00
|
|
|
virtual status_t CopyPixelsOut(BPoint source, BBitmap *dest);
|
|
|
|
virtual status_t CopyPixelsIn(BBitmap *source, BPoint dest);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2006-05-10 01:56:08 +04:00
|
|
|
virtual void FrameResized(float width, float height);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2010-02-09 01:50:38 +03:00
|
|
|
virtual void DirectConnected(direct_buffer_info *info);
|
|
|
|
virtual void EnableDirectMode(bool enabled);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2010-02-09 01:50:38 +03:00
|
|
|
inline int32 ReferenceCount() const { return fRefCount; };
|
|
|
|
inline ulong Options() const { return fOptions; };
|
|
|
|
inline BGLView * GLView() { return fView; };
|
2006-05-17 01:27:20 +04:00
|
|
|
inline BGLDispatcher * GLDispatcher() { return fDispatcher; };
|
|
|
|
|
2006-05-10 01:56:08 +04:00
|
|
|
private:
|
2006-09-07 11:47:22 +04:00
|
|
|
friend class GLRendererRoster;
|
|
|
|
|
2010-02-09 01:50:38 +03:00
|
|
|
virtual status_t _Reserved_Renderer_0(int32, void *);
|
|
|
|
virtual status_t _Reserved_Renderer_1(int32, void *);
|
|
|
|
virtual status_t _Reserved_Renderer_2(int32, void *);
|
|
|
|
virtual status_t _Reserved_Renderer_3(int32, void *);
|
|
|
|
virtual status_t _Reserved_Renderer_4(int32, void *);
|
2006-09-07 11:47:22 +04:00
|
|
|
|
2010-02-09 01:50:38 +03:00
|
|
|
volatile int32 fRefCount; // How much we're still usefull?
|
|
|
|
BGLView* fView; // Never forget who is the boss!
|
|
|
|
ulong fOptions; // Keep that tune in memory
|
|
|
|
BGLDispatcher* fDispatcher; // Our personal OpenGL API call dispatcher
|
2006-05-17 01:27:20 +04:00
|
|
|
|
2010-02-09 01:50:38 +03:00
|
|
|
GLRendererRoster* fOwningRoster;
|
|
|
|
renderer_id fID;
|
2005-06-27 00:21:09 +04:00
|
|
|
};
|
|
|
|
|
2008-01-27 01:51:51 +03:00
|
|
|
extern "C" _EXPORT BGLRenderer * instantiate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
|
|
|
|
|
|
|
#endif // GLRENDERER_H
|
|
|
|
|