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