Open Inventor Reference
SoGLCacheContextElement.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | This file defines the SoGLCacheContextElement class.
48 |
49 | Author(s) : Gavin Bell
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_CACHE_CONTEXT_ELEMENT
56#define _SO_CACHE_CONTEXT_ELEMENT
57
60
63#define OIV_AUTO_CACHE_DEFAULT_MAX 100000
64
81
92
94
95 public:
101 enum Type {
104 VERTEX_BUFFER_OBJECT
105 };
106 SoGLDisplayList(SoState *state, Type type, int numToAllocate=1);
107
114 void ref();
115 void unref(SoState *state = NULL);
116
122 void open(SoState *state, int index = 0);
123 void close(SoState *state);
124
132 void call(SoState *state, int index = 0);
133 void addDependency(SoState *state);
134
138 Type getType() { return type; }
139 int getNumAllocated() { return num; }
140 GLuint getFirstIndex() { return startIndex; }
141 int getContext() { return context; }
142
143 private:
145
146 Type type;
147 GLuint startIndex;
148 int num;
149 int refCount;
150 int context;
151
153};
154
155class SbIntList;
156
158
160
161 public:
163 virtual void init(SoState *state);
164
166 // The third argument indicates whether 2-pass
170 static void set(SoState *state, int context,
171 bool is2PassTransparency);
172
174 static int get(SoState *state);
175
178
181 static bool areMipMapsFast(SoState *state);
182
184
191 enum {
192 DO_AUTO_CACHE = 1,
193 DONT_AUTO_CACHE = 2
194 };
195
199 static void shouldAutoCache(SoState *state, int bits)
200 {
202 state->getElementNoPush(classStackIndex);
203 elt->autoCacheBits |= bits;
204 }
205
207 static void setAutoCacheBits(SoState *state, int bits)
209 classStackIndex))->autoCacheBits = bits;
210 }
211
212 static int resetAutoCacheBits(SoState *state)
213 {
215 state->getElementNoPush(classStackIndex);
216 int result = elt->autoCacheBits;
217 elt->autoCacheBits = 0;
218
219 return result;
220 }
221
223
225 virtual bool matches(const SoElement *elt) const;
226
228 virtual SoElement *copyMatchInfo() const;
229
231 virtual void print(FILE *fp) const;
232
233 SoINTERNAL public:
234 static void initClass();
235
236 protected:
240
242
243 private:
252 static void freeList(SoState *state,
253 SoGLDisplayList *list);
254
255 static SbPList * waitingToBeFreed;
256
257friend class SoGLDisplayList;
258};
259
260#endif /* _SO_CACHE_CONTEXT_ELEMENT */
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
#define SO_ELEMENT_HEADER(className)
This one is for non-abstract element classes.
List of generic (void *) pointers.
Definition SbPList.h:173
List of generic (void *) pointers.
Definition SbPList.h:78
This is the abstract base class for all state elements.
Definition SoElement.h:96
virtual void print(FILE *fp) const
Prints element (for debugging)
virtual ~SoGLCacheContextElement()
static int resetAutoCacheBits(SoState *state)
virtual bool matches(const SoElement *elt) const
Standard element stuff:
static void shouldAutoCache(SoState *state, int bits)
Called by nodes to say that they should/shouldn't be auto-cached (pass TRUE if should,...
static void set(SoState *state, int context, bool is2PassTransparency)
Sets the current context. This is done by the renderAction.
virtual void init(SoState *state)
Initializes element.
static bool areMipMapsFast(SoState *state)
Methods to quickly figure out if an OpenGL extension is available at run-time.
static void setAutoCacheBits(SoState *state, int bits)
Used by Separators to set/reset the auto-caching bits:
static void initClass()
static int get(SoState *state)
Gets the current context.
virtual SoElement * copyMatchInfo() const
Create and return a copy of this element.
Class SoGLDisplayList:
Type getType()
Get methods.
SoGLDisplayList(SoState *state, Type type, int numToAllocate=1)
void addDependency(SoState *state)
void call(SoState *state, int index=0)
Call a display list, or bind a texture object.
void unref(SoState *state=NULL)
void open(SoState *state, int index=0)
Open/close a display list.
void ref()
Because display lists may contain textures objects or other display lists, they must be reference cou...
void close(SoState *state)
An SoState collects and holds state while traversing a scene graph.
Definition SoState.h:82
SoElement * getElementNoPush(int stackIndex) const
Internal-only, dangerous method that returns a writeable element without checking for state depth and...
Definition SoState.h:135