tinyOffscreenGraphicsPipe.cxx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Filename: tinyOffscreenGraphicsPipe.cxx
  2. // Created by: drose (09Feb09)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #include "pandabase.h"
  15. #include "tinyOffscreenGraphicsPipe.h"
  16. #include "tinyGraphicsStateGuardian.h"
  17. #include "tinyGraphicsBuffer.h"
  18. #include "config_tinydisplay.h"
  19. #include "frameBufferProperties.h"
  20. TypeHandle TinyOffscreenGraphicsPipe::_type_handle;
  21. ////////////////////////////////////////////////////////////////////
  22. // Function: TinyOffscreenGraphicsPipe::Constructor
  23. // Access: Public
  24. // Description:
  25. ////////////////////////////////////////////////////////////////////
  26. TinyOffscreenGraphicsPipe::
  27. TinyOffscreenGraphicsPipe() {
  28. _supported_types = OT_buffer | OT_texture_buffer;
  29. _is_valid = true;
  30. }
  31. ////////////////////////////////////////////////////////////////////
  32. // Function: TinyOffscreenGraphicsPipe::Destructor
  33. // Access: Public, Virtual
  34. // Description:
  35. ////////////////////////////////////////////////////////////////////
  36. TinyOffscreenGraphicsPipe::
  37. ~TinyOffscreenGraphicsPipe() {
  38. }
  39. ////////////////////////////////////////////////////////////////////
  40. // Function: TinyOffscreenGraphicsPipe::get_interface_name
  41. // Access: Published, Virtual
  42. // Description: Returns the name of the rendering interface
  43. // associated with this GraphicsPipe. This is used to
  44. // present to the user to allow him/her to choose
  45. // between several possible GraphicsPipes available on a
  46. // particular platform, so the name should be meaningful
  47. // and unique for a given platform.
  48. ////////////////////////////////////////////////////////////////////
  49. string TinyOffscreenGraphicsPipe::
  50. get_interface_name() const {
  51. return "TinyPanda";
  52. }
  53. ////////////////////////////////////////////////////////////////////
  54. // Function: TinyOffscreenGraphicsPipe::pipe_constructor
  55. // Access: Public, Static
  56. // Description: This function is passed to the GraphicsPipeSelection
  57. // object to allow the user to make a default
  58. // TinyOffscreenGraphicsPipe.
  59. ////////////////////////////////////////////////////////////////////
  60. PT(GraphicsPipe) TinyOffscreenGraphicsPipe::
  61. pipe_constructor() {
  62. return new TinyOffscreenGraphicsPipe;
  63. }
  64. ////////////////////////////////////////////////////////////////////
  65. // Function: TinyOffscreenGraphicsPipe::make_output
  66. // Access: Protected, Virtual
  67. // Description: Creates a new window on the pipe, if possible.
  68. ////////////////////////////////////////////////////////////////////
  69. PT(GraphicsOutput) TinyOffscreenGraphicsPipe::
  70. make_output(const string &name,
  71. const FrameBufferProperties &fb_prop,
  72. const WindowProperties &win_prop,
  73. int flags,
  74. GraphicsEngine *engine,
  75. GraphicsStateGuardian *gsg,
  76. GraphicsOutput *host,
  77. int retry,
  78. bool &precertify) {
  79. // Only thing to try: a TinyGraphicsBuffer
  80. if (retry == 0) {
  81. if (((flags&BF_require_parasite)!=0)||
  82. ((flags&BF_require_window)!=0)) {
  83. return NULL;
  84. }
  85. return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
  86. }
  87. // Nothing else left to try.
  88. return NULL;
  89. }