Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GLRenderer.h 2.2KB

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