Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoGLCacheContextElement.h
00001 #ifndef COIN_SOGLCACHECONTEXTELEMENT_H
00002 #define COIN_SOGLCACHECONTEXTELEMENT_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/elements/SoSubElement.h>
00028 
00029 // This shouldn't strictly be necessary, but the OSF1/cxx compiler
00030 // complains if this is left out, while using the "friend class
00031 // SoGLDisplayList" statement in the class definition.
00032 class SoGLDisplayList;
00033 
00034 typedef void SoScheduleDeleteCB(void * closure, uint32_t contextid);
00035 
00036 // *************************************************************************
00037 
00038 class COIN_DLL_API SoGLCacheContextElement : public SoElement {
00039   typedef SoElement inherited;
00040 
00041   SO_ELEMENT_HEADER(SoGLCacheContextElement);
00042 
00043 public:
00044   static void initClass(void);
00045 protected:
00046   virtual ~SoGLCacheContextElement();
00047 
00048 public:
00049   virtual void init(SoState * state);
00050 
00051   virtual SbBool matches(const SoElement * elt) const;
00052   virtual SoElement * copyMatchInfo(void) const;
00053   static void set(SoState * state, int context,
00054                   SbBool twopasstransparency,
00055                   SbBool remoterendering);
00056   static int get(SoState * state);
00057   static int getExtID(const char * str);
00058   static void getOpenGLVersion(SoState * state, int & major, int & minor);
00059   static SbBool extSupported(SoState * state, int extid);
00060   static SbBool areMipMapsFast(SoState * state);
00061   enum {
00062     DO_AUTO_CACHE = 1,
00063     DONT_AUTO_CACHE
00064   };
00065   static void shouldAutoCache(SoState * state, int bits);
00066   static void setAutoCacheBits(SoState * state, int bits);
00067   static int resetAutoCacheBits(SoState * state);
00068   static SbBool getIsRemoteRendering(SoState * state);
00069 
00070   static uint32_t getUniqueCacheContext(void);
00071 
00072   static void scheduleDeleteCallback(const uint32_t contextid,
00073                                      SoScheduleDeleteCB * cb,
00074                                      void * closure);
00075 
00076   static void incNumShapes(SoState * state);
00077   static int getNumShapes(SoState * state);
00078   static void incNumSeparators(SoState * state);
00079   static int getNumSeparators(SoState * state);
00080 
00081 private:
00082   friend class SoGLDisplayList;
00083   static void scheduleDelete(SoState * state, SoGLDisplayList * dl);
00084   static void cleanupContext(uint32_t contextid, void * closure);
00085 
00086 private:
00087   int context;
00088   SbBool twopass;
00089   int autocachebits;
00090   int numshapes;
00091   int numseparators;
00092 
00093   enum { RENDERING_UNSET, RENDERING_SET_DIRECT, RENDERING_SET_INDIRECT };
00094   int rendering;
00095   SbBool isDirectRendering(SoState * state) const;
00096 };
00097 
00098 // *************************************************************************
00099 
00100 // For compatibility with client code originally written with SGI/TGS
00101 // Inventor:
00102 #ifndef COIN_INTERNAL
00103 #include <Inventor/elements/SoGLDisplayList.h>
00104 #endif // ! COIN_INTERNAL
00105 
00106 #endif // !COIN_SOGLCACHECONTEXTELEMENT_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen 1.7.5.1.