Panda3D
|
00001 // Filename: osMesaGraphicsPipe.cxx 00002 // Created by: drose (09Feb04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "osMesaGraphicsPipe.h" 00016 #include "osMesaGraphicsBuffer.h" 00017 #include "osMesaGraphicsStateGuardian.h" 00018 #include "config_mesadisplay.h" 00019 #include "frameBufferProperties.h" 00020 #include "mutexHolder.h" 00021 00022 TypeHandle OsMesaGraphicsPipe::_type_handle; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function: OsMesaGraphicsPipe::Constructor 00026 // Access: Public 00027 // Description: 00028 //////////////////////////////////////////////////////////////////// 00029 OsMesaGraphicsPipe:: 00030 OsMesaGraphicsPipe() { 00031 _supported_types = OT_buffer | OT_texture_buffer; 00032 _is_valid = true; 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: OsMesaGraphicsPipe::Destructor 00037 // Access: Public, Virtual 00038 // Description: 00039 //////////////////////////////////////////////////////////////////// 00040 OsMesaGraphicsPipe:: 00041 ~OsMesaGraphicsPipe() { 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: OsMesaGraphicsPipe::get_interface_name 00046 // Access: Published, Virtual 00047 // Description: Returns the name of the rendering interface 00048 // associated with this GraphicsPipe. This is used to 00049 // present to the user to allow him/her to choose 00050 // between several possible GraphicsPipes available on a 00051 // particular platform, so the name should be meaningful 00052 // and unique for a given platform. 00053 //////////////////////////////////////////////////////////////////// 00054 string OsMesaGraphicsPipe:: 00055 get_interface_name() const { 00056 return "Offscreen Mesa"; 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: OsMesaGraphicsPipe::pipe_constructor 00061 // Access: Public, Static 00062 // Description: This function is passed to the GraphicsPipeSelection 00063 // object to allow the user to make a default 00064 // OsMesaGraphicsPipe. 00065 //////////////////////////////////////////////////////////////////// 00066 PT(GraphicsPipe) OsMesaGraphicsPipe:: 00067 pipe_constructor() { 00068 return new OsMesaGraphicsPipe; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: OsMesaGraphicsPipe::make_output 00073 // Access: Protected, Virtual 00074 // Description: Creates a new window on the pipe, if possible. 00075 //////////////////////////////////////////////////////////////////// 00076 PT(GraphicsOutput) OsMesaGraphicsPipe:: 00077 make_output(const string &name, 00078 const FrameBufferProperties &fb_prop, 00079 const WindowProperties &win_prop, 00080 int flags, 00081 GraphicsEngine *engine, 00082 GraphicsStateGuardian *gsg, 00083 GraphicsOutput *host, 00084 int retry, 00085 bool &precertify) { 00086 00087 if (!_is_valid) { 00088 return NULL; 00089 } 00090 00091 if (retry == 0) { 00092 if ((!support_render_texture)|| 00093 ((flags&BF_require_parasite)!=0)|| 00094 ((flags&BF_require_window)!=0)|| 00095 ((flags&BF_resizeable)!=0)|| 00096 ((flags&BF_size_track_host)!=0)|| 00097 ((flags&BF_can_bind_every)!=0)|| 00098 ((flags&BF_rtt_cumulative)!=0)) { 00099 return NULL; 00100 } 00101 00102 // We know that OsMesa windows only support single buffering. So 00103 // don't bother asking for more than that. 00104 FrameBufferProperties fb_prop2 = fb_prop; 00105 fb_prop2.set_back_buffers(0); 00106 00107 return new OsMesaGraphicsBuffer(engine, this, name, fb_prop2, win_prop, 00108 flags, gsg, host); 00109 } 00110 00111 // Nothing else left to try. 00112 return NULL; 00113 }