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
|
2006-05-10 01:56:08 +04:00
|
|
|
BGLRenderer(const BGLRenderer &);
|
|
|
|
BGLRenderer & operator=(const BGLRenderer &);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
|
|
|
public:
|
2006-05-17 01:27:20 +04:00
|
|
|
BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
|
2006-05-10 01:56:08 +04:00
|
|
|
virtual ~BGLRenderer();
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2006-05-17 01:27:20 +04: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);
|
|
|
|
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
|
|
|
|
2006-05-10 01:56:08 +04:00
|
|
|
void DirectConnected( direct_buffer_info *info );
|
|
|
|
void EnableDirectMode( bool enabled );
|
2005-06-27 00:21:09 +04:00
|
|
|
|
2006-05-17 01:27:20 +04:00
|
|
|
inline int32 ReferenceCount() { return fRefCount; };
|
|
|
|
inline ulong Options() { return fOptions; };
|
|
|
|
inline BGLView * GLView() { return fView; };
|
|
|
|
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;
|
|
|
|
|
|
|
|
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-05-17 01:27:20 +04: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-09-07 11:47:22 +04:00
|
|
|
GLRendererRoster *fOwningRoster;
|
|
|
|
renderer_id fID;
|
2005-06-27 00:21:09 +04:00
|
|
|
};
|
|
|
|
|
2006-09-07 18:37:31 +04:00
|
|
|
extern "C" _EXPORT BGLRenderer * instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher);
|
2005-06-27 00:21:09 +04:00
|
|
|
|
|
|
|
|
|
|
|
#endif // GLRENDERER_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|