tinyGraphicsBuffer.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file tinyGraphicsBuffer.h
  10. * @author drose
  11. * @date 2008-08-08
  12. */
  13. #ifndef TINYGRAPHICSBUFFER_H
  14. #define TINYGRAPHICSBUFFER_H
  15. #include "pandabase.h"
  16. #include "graphicsBuffer.h"
  17. #include "tinyGraphicsStateGuardian.h"
  18. /**
  19. * An offscreen graphics buffer.
  20. */
  21. class EXPCL_TINYDISPLAY TinyGraphicsBuffer : public GraphicsBuffer {
  22. public:
  23. TinyGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
  24. const std::string &name,
  25. const FrameBufferProperties &fb_prop,
  26. const WindowProperties &win_prop,
  27. int flags,
  28. GraphicsStateGuardian *gsg,
  29. GraphicsOutput *host);
  30. virtual ~TinyGraphicsBuffer();
  31. virtual bool begin_frame(FrameMode mode, Thread *current_thread);
  32. virtual void end_frame(FrameMode mode, Thread *current_thread);
  33. INLINE ZBuffer *get_frame_buffer();
  34. protected:
  35. virtual void close_buffer();
  36. virtual bool open_buffer();
  37. private:
  38. void create_frame_buffer();
  39. private:
  40. ZBuffer *_frame_buffer;
  41. public:
  42. static TypeHandle get_class_type() {
  43. return _type_handle;
  44. }
  45. static void init_type() {
  46. GraphicsBuffer::init_type();
  47. register_type(_type_handle, "TinyGraphicsBuffer",
  48. GraphicsBuffer::get_class_type());
  49. }
  50. virtual TypeHandle get_type() const {
  51. return get_class_type();
  52. }
  53. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  54. private:
  55. static TypeHandle _type_handle;
  56. };
  57. #include "tinyGraphicsBuffer.I"
  58. #endif