00001 // Filename: config_glgsg.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 #include "config_glgsg.h" 00020 #include "glGraphicsStateGuardian.h" 00021 #include "glSavedFrameBuffer.h" 00022 #include "glTextureContext.h" 00023 #include "glGeomNodeContext.h" 00024 00025 #include <dconfig.h> 00026 00027 Configure(config_glgsg); 00028 NotifyCategoryDef(glgsg, ":display:gsg"); 00029 00030 // Configure this variable true to cause the GLGSG to show each 00031 // transform space it renders by drawing a little unit axis. This 00032 // cannot be enabled when the player is compiled in NDEBUG mode. 00033 bool gl_show_transforms = config_glgsg.GetBool("gl-show-transforms", false); 00034 00035 // Configure this true to glHint the textures into the cheapest 00036 // possible mode. 00037 bool gl_cheap_textures = config_glgsg.GetBool("gl-cheap-textures", false); 00038 00039 // Configure this true to perform a cull traversal over the geometry 00040 // by default, false otherwise. The cull traversal provides support 00041 // for state-sorting, z-sorting, and binning. 00042 bool gl_cull_traversal = config_glgsg.GetBool("gl-cull-traversal", true); 00043 00044 // Configure this true to disable the use of mipmapping in the 00045 // renderer. 00046 bool gl_ignore_mipmaps = config_glgsg.GetBool("gl-ignore-mipmaps", false); 00047 00048 // Configure this true to enable full trilinear mipmapping on every 00049 // texture, whether it asks for it or not. 00050 bool gl_force_mipmaps = config_glgsg.GetBool("gl-force-mipmaps", false); 00051 00052 // Configure this true to cause mipmaps to be rendered with phony 00053 // colors, using mipmap_level_*.rgb if they are available. 00054 bool gl_show_mipmaps = config_glgsg.GetBool("gl-show-mipmaps", false); 00055 00056 // Configure this true to cause the generated mipmap images to be 00057 // written out to image files on the disk as they are generated. 00058 bool gl_save_mipmaps = config_glgsg.GetBool("gl-save-mipmaps", false); 00059 00060 // Configure this true to cause all lighting normals to automatically 00061 // be normalized by the graphics hardware before rendering. This is 00062 // necessary if you intend to render things under scale transforms and 00063 // expect lighting to work correctly. Maybe one day there will be 00064 // another way to set this at runtime, instead of only as a configure 00065 // variable. 00066 bool gl_auto_normalize_lighting = config_glgsg.GetBool("auto-normalize-lighting", false); 00067 00068 // Configure this true to try to implement decals using a 00069 // DepthOffsetAttrib, false to do them with the more reliable 3-pass 00070 // rendering method instead. 00071 bool gl_depth_offset_decals = config_glgsg.GetBool("depth-offset-decals", false); 00072 00073 // Configure this true to indicate the current version of GL fully 00074 // supports textures with B, G, R ordering; false if it only supports 00075 // R, G, B. false will always work, but true might be faster if the 00076 // implementation supports it. 00077 #ifdef GL_BGR 00078 bool gl_supports_bgr = config_glgsg.GetBool("gl-supports-bgr", false); 00079 #else 00080 // If it's not even defined, we can't use it. 00081 bool gl_supports_bgr = false; 00082 #endif // GL_BGR 00083 00084 // Configure this false if your GL's implementation of glColorMask() 00085 // is broken (some are). This will force the use of a (presumably) 00086 // more expensive blending operation instead. 00087 bool gl_color_mask = config_glgsg.GetBool("gl-color-mask", true); 00088 00089 ConfigureFn(config_glgsg) { 00090 init_libglgsg(); 00091 } 00092 00093 //////////////////////////////////////////////////////////////////// 00094 // Function: init_libglgsg 00095 // Description: Initializes the library. This must be called at 00096 // least once before any of the functions or classes in 00097 // this library can be used. Normally it will be 00098 // called by the static initializers and need not be 00099 // called explicitly, but special cases exist. 00100 //////////////////////////////////////////////////////////////////// 00101 void 00102 init_libglgsg() { 00103 static bool initialized = false; 00104 if (initialized) { 00105 return; 00106 } 00107 initialized = true; 00108 00109 GLGraphicsStateGuardian::init_type(); 00110 GLSavedFrameBuffer::init_type(); 00111 GLTextureContext::init_type(); 00112 GLGeomNodeContext::init_type(); 00113 }