00001 // Filename: config_display.cxx 00002 // Created by: drose (06Oct99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 #include "config_display.h" 00021 #include "graphicsStateGuardian.h" 00022 #include "savedFrameBuffer.h" 00023 #include "graphicsPipe.h" 00024 #include "graphicsWindow.h" 00025 #include "graphicsChannel.h" 00026 #include "graphicsLayer.h" 00027 #include "hardwareChannel.h" 00028 #include "textureContext.h" 00029 #include "geomNodeContext.h" 00030 #include "geomContext.h" 00031 00032 ConfigureDef(config_display); 00033 NotifyCategoryDef(display, ""); 00034 NotifyCategoryDef(gsg, display_cat); 00035 00036 ConfigureFn(config_display) { 00037 init_libdisplay(); 00038 } 00039 00040 // This is normally true; set it false to disable view-frustum culling 00041 // (primarily useful for debugging). 00042 const bool view_frustum_cull = config_display.GetBool("view-frustum-cull", true); 00043 00044 // Set this true to show the number of unused states in the pstats 00045 // graph for TransformState and RenderState counts. This adds a bit 00046 // of per-frame overhead to count these things up. 00047 const bool pstats_unused_states = config_display.GetBool("pstats-unused-states", false); 00048 00049 // This is the default threading model to use for new windows. Use 00050 // empty string for single-threaded, or something like "cull/draw" for 00051 // a 3-stage pipeline. See GraphicsEngine::set_threading_model(). 00052 00053 // Warning! The code that uses this is currently experimental and 00054 // incomplete, and will almost certainly crash! Do not set 00055 // threading-model to anything other than its default of a 00056 // single-threaded model unless you are developing Panda's threading 00057 // system! 00058 const string threading_model = config_display.GetString("threading-model", ""); 00059 00060 // This indicates the initial setting of the auto-flip flag. Set it 00061 // true (the default) to cause render_frame() to flip all the windows 00062 // before it returns (in single-threaded mode only), or false to wait 00063 // until an explicit call to flip_frame() or the next render_frame(). 00064 const bool auto_flip = config_display.GetBool("auto-flip", true); 00065 00066 // Use the variable load-display to specifiy the name of the default 00067 // graphics display library or GraphicsPipe to load. It is the name 00068 // of a shared library (or * for all libraries named in aux-display), 00069 // optionally followed by the name of the particular GraphicsPipe 00070 // class to create. 00071 00072 // Also use the variable aux-display to name each of the graphics 00073 // display libraries that are available on a particular platform. 00074 // This variable may be repeated several times. 00075 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: init_libdisplay 00079 // Description: Initializes the library. This must be called at 00080 // least once before any of the functions or classes in 00081 // this library can be used. Normally it will be 00082 // called by the static initializers and need not be 00083 // called explicitly, but special cases exist. 00084 //////////////////////////////////////////////////////////////////// 00085 void 00086 init_libdisplay() { 00087 static bool initialized = false; 00088 if (initialized) { 00089 return; 00090 } 00091 initialized = true; 00092 00093 GraphicsStateGuardian::init_type(); 00094 SavedFrameBuffer::init_type(); 00095 GraphicsPipe::init_type(); 00096 GraphicsWindow::init_type(); 00097 GraphicsChannel::init_type(); 00098 GraphicsLayer::init_type(); 00099 HardwareChannel::init_type(); 00100 TextureContext::init_type(); 00101 GeomNodeContext::init_type(); 00102 GeomContext::init_type(); 00103 }