Oolite
Loading...
Searching...
No Matches
OOOpenGLStateManager.m
Go to the documentation of this file.
1/*
2
3OOOpenGLStateManager.m
4
5Implementation of OOSetOpenGLState()/OOVerifyOpenGLState().
6
7
8Oolite
9Copyright (C) 2004-2013 Giles C Williams and contributors
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24MA 02110-1301, USA.
25
26*/
27
29#import "OOLogging.h"
30#import "OOMacroOpenGL.h"
31#import "OOMaths.h"
32#import "OOOpenGL.h"
34
35/* DESIGN NOTES
36
37 The state manager is heavily based on macro metaprogramming, to avoid copy-
38 and-paste errors. The state it manages is defined in OOOpenGLStates.tbl,
39 which is included each time something needs to be done for each state item
40 (currently six times in total). The exception is the GL blend mode, which
41 is represented by two variables but set with a single glBlendFunc() call;
42 this needs to be managed separately.
43
44 For the meanings of the different ITEM_FOO macro used, see OOOpenGLStates.tbl.
45
46 The states are defined as structs but referred to by index so that the
47 definitions are all in one place. This somewhat reduces the chance of
48 missing one when updating OOOpenGLStates.tbl. The actual definitions are
49 at the bottom of this file.
50*/
51
52typedef enum {
53 kStateFalse = false,
54 kStateTrue = true,
56} StateFlag;
57
58typedef struct
59{
60 const char* name;
61
62#define ITEM_STATEFLAG(NAME) StateFlag NAME
63#define ITEM_CLIENTSTATEFLAG(NAME) bool NAME
64#define ITEM_SPECIAL(NAME, TYPE, _) TYPE NAME
65#define ITEM_INT(NAME) GLint NAME
66
67#include "OOOpenGLStates.tbl"
68
69 // These require extra-special handling, because they're set with one function.
70 GLint BLEND_SRC;
71 GLint BLEND_DST;
72
73#undef ITEM_STATEFLAG
74#undef ITEM_CLIENTSTATEFLAG
75#undef ITEM_SPECIAL
76#undef ITEM_INT
78
79static const OOOpenGLState kStandardStates[OPENGL_STATE_INTERNAL_USE_ONLY + 1];
80
82
83/* SwitchOpenGLStateInternal(sourceState, targetState)
84
85 Applies the differences between sourceState and targetState. It is assumed
86 that sourceState accurately reflects the current state.
87*/
88static void SwitchOpenGLStateInternal(const OOOpenGLState* sourceState, const OOOpenGLState* targetState) NONNULL_FUNC;
89
90/* Accessors
91
92 These functions and macros are used to read and write ITEM_SPECIAL state
93 items. The GetState_ accessors are used only in debug mode, while the
94 SetState_ acccessors are used in either mode.
95*/
96#ifndef NDEBUG
97static inline bool GetState_DEPTH_WRITEMASK(void)
98{
100
101 GLboolean value;
102 OOGL(glGetBooleanv(GL_DEPTH_WRITEMASK, &value));
103 return value;
104}
105#endif
106
107#define SetState_DEPTH_WRITEMASK(VALUE) OOGL(glDepthMask(VALUE))
108
109#define SetState_SHADE_MODEL(VALUE) OOGL(glShadeModel(VALUE))
110
111#ifndef NDEBUG
112static inline GLenum GetState_TEXTURE_ENV_MODE(void)
113{
115
116 GLint value;
117 OOGL(glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &value));
118 return value;
119}
120#endif
121
122#define SetState_TEXTURE_ENV_MODE(VALUE) OOGL(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, VALUE))
123
124#if OO_MULTITEXTURE
125#ifndef NDEBUG
126static inline GLenum GetState_ACTIVE_TEXTURE(void)
127{
129
130 GLint value;
131 OOGL(glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &value));
132 return value;
133}
134#endif
135
136#define SetState_ACTIVE_TEXTURE(VALUE) OOGL(glActiveTextureARB(VALUE))
137
138#ifndef NDEBUG
139static inline GLenum GetState_CLIENT_ACTIVE_TEXTURE(void)
140{
142
143 GLint value;
144 OOGL(glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE_ARB, &value));
145 return value;
146}
147#endif
148
149#define SetState_CLIENT_ACTIVE_TEXTURE(VALUE) OOGL(glClientActiveTextureARB(VALUE))
150
151#else
152static inline GLenum GetState_ACTIVE_TEXTURE(void) { }
153static inline void SetState_ACTIVE_TEXTURE(GLenum value) { }
154static inline GLenum GetState_CLIENT_ACTIVE_TEXTURE(void) { }
155static inline void SetState_CLIENT_ACTIVE_TEXTURE(GLenum value) { }
156#endif
157
158static inline void SetState_CULL_FACE_MODE(GLint value)
159{
161
162 OOGL(glCullFace(value));
163}
164
165#define SetState_FRONT_FACE(VALUE) OOGL(glFrontFace(VALUE))
166
167#if OO_GL_STATE_VERIFICATION
168/* Debug mode implementation.
169 */
170
171static NSString* const kOOLogOpenGLVerifyDump = @"rendering.opengl.state";
172
173/*
174 VerifyOpenGLStateInternal(caller, nominalCaller, line)
175
176 Tests whether the current OpenGL state matches the last set nominal state.
177 If not, it logs the differences, then reverts to the last set nominal state
178 (using SwitchOpenGLStateInternal()).
179*/
180static void VerifyOpenGLStateInternal(const char* caller, const char* nominalCaller, unsigned line) NONNULL_FUNC;
181
182/* GetCurrentOpenGLState(state)
183
184 Retrieves the current OpenGL state.
185*/
187
188/* StatesEqual(a, b)
189
190 Test whether two states are identical.
191*/
192static bool StatesEqual(const OOOpenGLState* a, const OOOpenGLState* b) NONNULL_FUNC;
193
194#if OO_CHECK_GL_HEAVY
195/* OOGLNoteCurrentFunction(function, line)
196
197 If OO_GL_STATE_VERIFICATION && OO_CHECK_GL_HEAVY, OOGL() calls
198 OOGLNoteCurrentFunction() to help us keep track of where OpenGL calls have
199 been made recently. The penultimate seen function is logged when we come
200 across a state error, which is occasionally actually helpful.
201*/
202
203static const char* sLatestFunction = "<none yet>";
204static unsigned sLatestLine;
205static const char* sPreviousFunction = "<none yet>";
206static unsigned sPreviousLine;
207static bool sGLFunctionTracking = true;
208
209void OOGLNoteCurrentFunction(const char* function, unsigned line)
210{
211 if (sGLFunctionTracking) {
212 if (function != sLatestFunction) {
213 sPreviousFunction = sLatestFunction;
214 sPreviousLine = sLatestLine;
215 sLatestFunction = function;
216 }
217 sLatestLine = line;
218 }
219}
220
221/* SetFunctionTracking()
222
223 Enable or disable OOGLNoteCurrentFunction(). It is disabled within the
224 state manager implementation.
225*/
226static inline void SetFunctionTracking(bool value)
227{
228 sGLFunctionTracking = value;
229}
230
231#else
232
233static inline void OOGLNoteCurrentFunction(const char* function, unsigned line) { }
234static inline void SetFunctionTracking(bool value) { }
235
236#endif
237
238void OOSetOpenGLState_(OOOpenGLStateID state, const char* function, unsigned line)
239{
240 NSCParameterAssert((unsigned)state < OPENGL_STATE_INTERNAL_USE_ONLY);
241
242 OOGLNoteCurrentFunction(function, line);
243 SetFunctionTracking(false);
244
245 VerifyOpenGLStateInternal("OOSetOpenGLState", function, line);
246
247 if (state != sCurrentStateID) {
249 sCurrentStateID = state;
250 }
251
253}
254
255void OOVerifyOpenGLState_(const char* function, unsigned line)
256{
257 OOGLNoteCurrentFunction(function, line);
258 SetFunctionTracking(false);
259
260 VerifyOpenGLStateInternal("OOVerifyOpenGLState", function, line);
261
263}
264
266{
267 static const char* name = "<current state>";
268
269 NSCParameterAssert(state != NULL);
271 memset(state, 0, sizeof *state);
272 state->name = name;
273
274#define ITEM_STATEFLAG(NAME) OOGL(state->NAME = glIsEnabled(GL_##NAME))
275#define ITEM_CLIENTSTATEFLAG(NAME) OOGL(state->NAME = glIsEnabled(GL_##NAME))
276#define ITEM_SPECIAL(NAME, _, __) state->NAME = GetState_##NAME()
277#define ITEM_INT(NAME) OOGL(glGetIntegerv(GL_##NAME, &state->NAME))
278
279#include "OOOpenGLStates.tbl"
280
281 OOGL(glGetIntegerv(GL_BLEND_SRC, &state->BLEND_SRC));
282 OOGL(glGetIntegerv(GL_BLEND_DST, &state->BLEND_DST));
283
284#undef ITEM_STATEFLAG
285#undef ITEM_CLIENTSTATEFLAG
286#undef ITEM_SPECIAL
287#undef ITEM_INT
288}
289
290static bool StatesEqual(const OOOpenGLState* a, const OOOpenGLState* b)
291{
292 NSCParameterAssert(a != NULL && b != NULL);
293
294#define ITEM_STATEFLAG(NAME) \
295 do { \
296 if (a->NAME != b->NAME && a->NAME != kStateMaybe && b->NAME != kStateMaybe) \
297 return false; \
298 } while (0)
299#define ITEM_CLIENTSTATEFLAG(NAME) \
300 do { \
301 if (a->NAME != b->NAME) \
302 return false; \
303 } while (0)
304#define ITEM_SPECIAL(NAME, _, __) \
305 do { \
306 if (a->NAME != b->NAME) \
307 return false; \
308 } while (0)
309#define ITEM_INT(NAME) \
310 do { \
311 if (a->NAME != b->NAME) \
312 return false; \
313 } while (0)
314
315#include "OOOpenGLStates.tbl"
316
317#undef ITEM_STATEFLAG
318#undef ITEM_CLIENTSTATEFLAG
319#undef ITEM_SPECIAL
320#undef ITEM_INT
321
322 return true;
323}
324
325static void VerifyOpenGLStateInternal(const char* caller, const char* nominalCaller, unsigned line)
326{
327 OOOpenGLState currentState;
328 GetCurrentOpenGLState(&currentState);
329
330 NSCParameterAssert(sCurrentStateID <= OPENGL_STATE_INTERNAL_USE_ONLY);
331
332 const OOOpenGLState* expectedState = &kStandardStates[sCurrentStateID];
333
334 if (!StatesEqual(&currentState, expectedState)) {
336 OOLog(kOOLogOpenGLVerifyDump, @"Incorrect OpenGL state in %s (line %u)->%s", nominalCaller, line, caller);
337#if OO_CHECK_GL_HEAVY
338 OOLog(kOOLogOpenGLVerifyDump, @"Previous OpenGL-using function: %s (line %u)", sPreviousFunction, sPreviousLine);
339#endif
340 OOLog(kOOLogOpenGLVerifyDump, @"Expected previous state: %s", expectedState->name);
341
342 OOLogIndent();
343
344#define TEST_ITEM(NAME_, DISP_) \
345 if (currentState.NAME_ != expectedState->NAME_) { \
346 OOLog(kOOLogOpenGLVerifyDump, @"GL_%@ should be %@ but is %@.", @ #NAME_, DISP_(expectedState->NAME_), DISP_(currentState.NAME_)); \
347 }
348
349#define ITEM_STATEFLAG(NAME) \
350 if (expectedState->NAME != kStateMaybe) { \
351 TEST_ITEM(NAME, OOGLFlagToString) \
352 }
353#define ITEM_CLIENTSTATEFLAG(NAME) TEST_ITEM(NAME, OOGLFlagToString)
354#define ITEM_SPECIAL(NAME, _, __) TEST_ITEM(NAME, OOGLFlagToString)
355#define ITEM_INT(NAME) TEST_ITEM(NAME, OOGLEnumToString)
356
357#include "OOOpenGLStates.tbl"
358
359 if (currentState.BLEND_SRC != expectedState->BLEND_SRC || currentState.BLEND_DST != expectedState->BLEND_DST) {
360 OOLog(kOOLogOpenGLVerifyDump, @"GL blend mode should be %@, %@ but is %@, %@.", OOGLEnumToString(expectedState->BLEND_SRC), OOGLEnumToString(expectedState->BLEND_DST), OOGLEnumToString(currentState.BLEND_SRC), OOGLEnumToString(currentState.BLEND_DST));
361 }
362
363#undef ITEM_STATEFLAG
364#undef ITEM_CLIENTSTATEFLAG
365#undef ITEM_SPECIAL
366#undef ITEM_INT
367
368#undef TEST_ITEM
369
370 OOLogOutdent();
371 }
372
373 SwitchOpenGLStateInternal(&currentState, expectedState);
374 }
375}
376
377#else // OO_GL_STATE_VERIFICATION
378/* Non-debug mode implementation.
379
380 OOSetOpenGLState() performs a switch from the previous nominal state to the
381 new nominal state, without checking that the previous nominal state matches
382 the actual state. OOVerifyOpenGLState is a do-nothing macro.
383*/
384
386{
387 NSCParameterAssert((unsigned)state < OPENGL_STATE_INTERNAL_USE_ONLY);
388
389 if (state != sCurrentStateID) {
391 sCurrentStateID = state;
392 }
393}
394
395#endif // OO_GL_STATE_VERIFICATION
396
397static void SwitchOpenGLStateInternal(const OOOpenGLState* sourceState, const OOOpenGLState* targetState)
398{
399 NSCParameterAssert(sourceState != NULL && targetState != NULL);
401
402#define ITEM_STATEFLAG(NAME) \
403 if (sourceState->NAME != targetState->NAME && sourceState->NAME != kStateMaybe && targetState->NAME != kStateMaybe) { \
404 if (targetState->NAME) { \
405 OOGL(glEnable(GL_##NAME)); \
406 } else { \
407 OOGL(glDisable(GL_##NAME)); \
408 } \
409 }
410#define ITEM_CLIENTSTATEFLAG(NAME) \
411 if (sourceState->NAME != targetState->NAME) { \
412 if (targetState->NAME) { \
413 OOGL(glEnableClientState(GL_##NAME)); \
414 } else { \
415 OOGL(glDisableClientState(GL_##NAME)); \
416 } \
417 }
418#define ITEM_SPECIAL(NAME, TYPE, _) \
419 if (sourceState->NAME != targetState->NAME) { \
420 SetState_##NAME(targetState->NAME); \
421 }
422#define ITEM_INT(NAME) \
423 if (sourceState->NAME != targetState->NAME) { \
424 SetState_##NAME(targetState->NAME); \
425 }
426
427#include "OOOpenGLStates.tbl"
428
429 /* some implementations, in non-shader mode, seem to throw out/reset
430 * BlendFunc if Blend is disabled. Therefore, if coming from Blend=false
431 * always reset the blend function even if this should be unnecessary
432 * CIM: 3/1/13 */
433 if (sourceState->BLEND_SRC != targetState->BLEND_SRC || sourceState->BLEND_DST != targetState->BLEND_DST || !sourceState->BLEND) {
434 OOGL(glBlendFunc(targetState->BLEND_SRC, targetState->BLEND_DST));
435 }
436
437#undef ITEM_STATEFLAG
438#undef ITEM_CLIENTSTATEFLAG
439#undef ITEM_SPECIAL
440#undef ITEM_INT
441}
442
444{
445 // State has been reset behind our backs, so to speak; don't verify.
447}
448
449// The state definitions.
450static const OOOpenGLState kStandardStates[OPENGL_STATE_INTERNAL_USE_ONLY + 1] = {
451 [OPENGL_STATE_INTERNAL_USE_ONLY] = {
452 .name = "<canonical initial state>",
453 .LIGHTING = false,
454 .LIGHT0 = false,
455 .LIGHT1 = false,
456 .LIGHT2 = false,
457 .LIGHT3 = false,
458 .LIGHT4 = false,
459 .LIGHT5 = false,
460 .LIGHT6 = false,
461 .LIGHT7 = false,
462 .TEXTURE_2D = false,
463 .COLOR_MATERIAL = false,
464 .SHADE_MODEL = GL_SMOOTH,
465 .TEXTURE_ENV_MODE = GL_MODULATE,
466 .ACTIVE_TEXTURE = GL_TEXTURE0,
467 .CLIENT_ACTIVE_TEXTURE = GL_TEXTURE0,
468 .BLEND = false,
469 .BLEND_SRC = GL_ONE,
470 .BLEND_DST = GL_ZERO,
471 .FOG = false,
472 .VERTEX_ARRAY = false,
473 .NORMAL_ARRAY = false,
474 .COLOR_ARRAY = false,
475 .INDEX_ARRAY = false,
476 .TEXTURE_COORD_ARRAY = false,
477 .EDGE_FLAG_ARRAY = false,
478 .NORMALIZE = false,
479 .RESCALE_NORMAL = false,
480 .DEPTH_TEST = false,
481 .DEPTH_WRITEMASK = true,
482 .CULL_FACE = false,
483 .CULL_FACE_MODE = GL_BACK,
484 .FRONT_FACE = GL_CCW,
485 },
486 [OPENGL_STATE_OPAQUE] = {
487 .name = "OPENGL_STATE_OPAQUE",
488 .LIGHTING = true,
489 .LIGHT0 = kStateMaybe,
490 /* FIXME: in shader mode, these should not be kStateMaybe, but
491 * false for 0 and true for 1. On the other hand, in shader mode
492 * these settings are supposed to be irrelevant. */
493 .LIGHT1 = kStateMaybe, // FIXME: see above
494 .LIGHT2 = false,
495 .LIGHT3 = false,
496 .LIGHT4 = false,
497 .LIGHT5 = false,
498 .LIGHT6 = false,
499 .LIGHT7 = false,
500 .TEXTURE_2D = true,
501 .COLOR_MATERIAL = false,
502 .SHADE_MODEL = GL_SMOOTH,
503 .TEXTURE_ENV_MODE = GL_MODULATE,
504 .ACTIVE_TEXTURE = GL_TEXTURE0,
505 .CLIENT_ACTIVE_TEXTURE = GL_TEXTURE0,
506 .BLEND = false,
507 .BLEND_SRC = GL_SRC_ALPHA,
508 .BLEND_DST = GL_ONE_MINUS_SRC_ALPHA,
509 .FOG = kStateMaybe,
510 .VERTEX_ARRAY = true,
511 .NORMAL_ARRAY = true,
512 .COLOR_ARRAY = false,
513 .INDEX_ARRAY = false,
514 .TEXTURE_COORD_ARRAY = false,
515 .EDGE_FLAG_ARRAY = false,
516 .NORMALIZE = false,
517 .RESCALE_NORMAL = false,
518 .DEPTH_TEST = true,
519 .DEPTH_WRITEMASK = true,
520 .CULL_FACE = true,
521 .CULL_FACE_MODE = GL_BACK,
522 .FRONT_FACE = GL_CCW,
523 },
524 [OPENGL_STATE_TRANSLUCENT_PASS] = {
525 .name = "OPENGL_STATE_TRANSLUCENT_PASS",
526 .LIGHTING = false,
527 .LIGHT0 = kStateMaybe, // FIXME: see above
528 .LIGHT1 = kStateMaybe, // FIXME: see above
529 .LIGHT2 = false,
530 .LIGHT3 = false,
531 .LIGHT4 = false,
532 .LIGHT5 = false,
533 .LIGHT6 = false,
534 .LIGHT7 = false,
535 .TEXTURE_2D = false,
536 .COLOR_MATERIAL = false,
537 .SHADE_MODEL = GL_SMOOTH,
538 .TEXTURE_ENV_MODE = GL_MODULATE,
539 .ACTIVE_TEXTURE = GL_TEXTURE0,
540 .CLIENT_ACTIVE_TEXTURE = GL_TEXTURE0,
541 .BLEND = false,
542 .BLEND_SRC = GL_SRC_ALPHA,
543 .BLEND_DST = GL_ONE_MINUS_SRC_ALPHA,
544 .FOG = kStateMaybe,
545 .VERTEX_ARRAY = false,
546 .NORMAL_ARRAY = false,
547 .COLOR_ARRAY = false,
548 .INDEX_ARRAY = false,
549 .TEXTURE_COORD_ARRAY = false,
550 .EDGE_FLAG_ARRAY = false,
551 .NORMALIZE = false,
552 .RESCALE_NORMAL = false,
553 .DEPTH_TEST = true,
554 .DEPTH_WRITEMASK = false,
555 .CULL_FACE = true,
556 .CULL_FACE_MODE = GL_BACK,
557 .FRONT_FACE = GL_CCW,
558 },
559 [OPENGL_STATE_ADDITIVE_BLENDING] = {
560 .name = "OPENGL_STATE_ADDITIVE_BLENDING",
561 .LIGHTING = false,
562 .LIGHT0 = kStateMaybe, // FIXME: see above
563 .LIGHT1 = kStateMaybe, // FIXME: see above
564 .LIGHT2 = false,
565 .LIGHT3 = false,
566 .LIGHT4 = false,
567 .LIGHT5 = false,
568 .LIGHT6 = false,
569 .LIGHT7 = false,
570 .TEXTURE_2D = false,
571 .COLOR_MATERIAL = false,
572 .SHADE_MODEL = GL_SMOOTH,
573 .TEXTURE_ENV_MODE = GL_MODULATE, // Should be GL_BLEND?
574 .ACTIVE_TEXTURE = GL_TEXTURE0,
575 .CLIENT_ACTIVE_TEXTURE = GL_TEXTURE0,
576 .BLEND = true,
577 .BLEND_SRC = GL_SRC_ALPHA,
578 .BLEND_DST = GL_ONE,
579 .FOG = kStateMaybe,
580 .VERTEX_ARRAY = true,
581 .NORMAL_ARRAY = false,
582 .COLOR_ARRAY = false,
583 .INDEX_ARRAY = false,
584 .TEXTURE_COORD_ARRAY = false,
585 .EDGE_FLAG_ARRAY = false,
586 .NORMALIZE = false,
587 .RESCALE_NORMAL = false,
588 .DEPTH_TEST = true,
589 .DEPTH_WRITEMASK = false,
590 .CULL_FACE = false,
591 .CULL_FACE_MODE = GL_BACK,
592 .FRONT_FACE = GL_CCW,
593 },
594 [OPENGL_STATE_OVERLAY] = {
595 .name = "OPENGL_STATE_OVERLAY",
596 .LIGHTING = false,
597 .LIGHT0 = kStateMaybe, // FIXME: see above
598 .LIGHT1 = kStateMaybe, // FIXME: see above
599 .LIGHT2 = false,
600 .LIGHT3 = false,
601 .LIGHT4 = false,
602 .LIGHT5 = false,
603 .LIGHT6 = false,
604 .LIGHT7 = false,
605 .TEXTURE_2D = false,
606 .COLOR_MATERIAL = false,
607 .SHADE_MODEL = GL_SMOOTH,
608 .TEXTURE_ENV_MODE = GL_MODULATE,
609 .ACTIVE_TEXTURE = GL_TEXTURE0,
610 .CLIENT_ACTIVE_TEXTURE = GL_TEXTURE0,
611 .BLEND = true,
612 .BLEND_SRC = GL_SRC_ALPHA,
613 .BLEND_DST = GL_ONE_MINUS_SRC_ALPHA,
614 .FOG = false,
615 .VERTEX_ARRAY = false,
616 .NORMAL_ARRAY = false,
617 .COLOR_ARRAY = false,
618 .INDEX_ARRAY = false,
619 .TEXTURE_COORD_ARRAY = false,
620 .EDGE_FLAG_ARRAY = false,
621 .NORMALIZE = false,
622 .RESCALE_NORMAL = false,
623 .DEPTH_TEST = false,
624 .DEPTH_WRITEMASK = false,
625 .CULL_FACE = false, // ??
626 .CULL_FACE_MODE = GL_BACK,
627 .FRONT_FACE = GL_CCW,
628 }
629};
#define NONNULL_FUNC
BOOL OOLogWillDisplayMessagesInClass(NSString *inMessageClass)
Definition OOLogging.m:136
void OOLogOutdent(void)
Definition OOLogging.m:354
#define OOLog(class, format,...)
Definition OOLogging.h:84
void OOLogIndent(void)
Definition OOLogging.m:345
#define OO_ENTER_OPENGL()
static const OOOpenGLState kStandardStates[OPENGL_STATE_INTERNAL_USE_ONLY+1]
static bool GetState_DEPTH_WRITEMASK(void)
static void SetState_CLIENT_ACTIVE_TEXTURE(GLenum value)
static NSString *const kOOLogOpenGLVerifyDump
static GLenum GetState_CLIENT_ACTIVE_TEXTURE(void)
static void SetFunctionTracking(bool value)
void OOResetGLStateVerifier(void)
static void GetCurrentOpenGLState(OOOpenGLState *state) NONNULL_FUNC
static void VerifyOpenGLStateInternal(const char *caller, const char *nominalCaller, unsigned line) NONNULL_FUNC
static GLenum GetState_ACTIVE_TEXTURE(void)
static GLenum GetState_TEXTURE_ENV_MODE(void)
static void SetState_ACTIVE_TEXTURE(GLenum value)
static OOOpenGLStateID sCurrentStateID
static bool StatesEqual(const OOOpenGLState *a, const OOOpenGLState *b) NONNULL_FUNC
static void SetState_CULL_FACE_MODE(GLint value)
static void SwitchOpenGLStateInternal(const OOOpenGLState *sourceState, const OOOpenGLState *targetState) NONNULL_FUNC
void OOVerifyOpenGLState_(const char *function, unsigned line)
void OOSetOpenGLState_(OOOpenGLStateID state, const char *function, unsigned line)
static void OOGLNoteCurrentFunction(const char *function, unsigned line)
@ kStateFalse
@ kStateMaybe
NSString * OOGLEnumToString(GLenum value)
Definition OOOpenGL.m:471
OOOpenGLStateID
Definition OOOpenGL.h:120
@ OPENGL_STATE_INTERNAL_USE_ONLY
Definition OOOpenGL.h:126
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:132
#define OOGL(statement)
Definition OOOpenGL.h:262