• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2006, Philippe Houdoin. All rights reserved.
3  * Distributed under the terms of the MIT License.
4 
5  * This header defines BGLRenderer, the base class making up
6  * the Haiku GL renderer add-ons (essentially selfcontained C++
7  * shared libraries that do the actual rendering such as
8  * libswpipe.so and libswrast.so)
9  */
10 #ifndef GLRENDERER_H
11 #define GLRENDERER_H
12 
13 
14 #include <BeBuild.h>
15 #include <GLView.h>
16 
17 
18 class BGLDispatcher;
19 class GLRendererRoster;
20 
21 typedef unsigned long renderer_id;
22 
23 class _EXPORT BGLRenderer
24 {
25 							// Private unimplemented copy constructors
26 							BGLRenderer(const BGLRenderer &);
27 							BGLRenderer & operator=(const BGLRenderer &);
28 
29 public:
30 							BGLRenderer(BGLView *view, ulong bgl_options);
31 	virtual					~BGLRenderer();
32 
33 	void 					Acquire();
34 	void					Release();
35 
36 	virtual void			LockGL();
37 	virtual void 			UnlockGL();
38 
39 	virtual	void 			SwapBuffers(bool VSync = false);
40 	virtual	void			Draw(BRect updateRect);
41 	virtual status_t		CopyPixelsOut(BPoint source, BBitmap *dest);
42 	virtual status_t    	CopyPixelsIn(BBitmap *source, BPoint dest);
43 
44 	virtual void			FrameResized(float width, float height);
45 
46 	virtual void			DirectConnected(direct_buffer_info *info);
47 	virtual void			EnableDirectMode(bool enabled);
48 
ReferenceCount()49 	inline	int32			ReferenceCount() const { return fRefCount; };
Options()50 	inline	ulong			Options() const { return fOptions; };
GLView()51 	inline	BGLView*		GLView() { return fView; };
52 
53 private:
54 	friend class GLRendererRoster;
55 
56 	virtual status_t		_Reserved_Renderer_0(int32, void *);
57 	virtual status_t		_Reserved_Renderer_1(int32, void *);
58 	virtual status_t		_Reserved_Renderer_2(int32, void *);
59 	virtual status_t		_Reserved_Renderer_3(int32, void *);
60 	virtual status_t		_Reserved_Renderer_4(int32, void *);
61 
62 	int32					fRefCount;	// How much we're still useful
63 	BGLView*				fView;		// Never forget who is the boss!
64 	ulong					fOptions;	// Keep that tune in memory
65 
66 	GLRendererRoster*		fOwningRoster;
67 	renderer_id				fID;
68 };
69 
70 extern "C" _EXPORT BGLRenderer* instantiate_gl_renderer(BGLView *view, ulong options);
71 
72 
73 #endif	// GLRENDERER_H
74