Oolite
Loading...
Searching...
No Matches
OOOpenGL.m File Reference
Include dependency graph for OOOpenGL.m:

Go to the source code of this file.

Macros

#define COLOR_EQUAL(color, r, g, b, a)
#define COLOR_CASE(r, g, b, a, str)
#define DUMP_STATE_FLAG(x)
#define DUMP_GET_FLAG(x)
#define CASE(x)

Functions

BOOL OOCheckOpenGLErrors (NSString *format,...)
void OOGLWireframeModeOn (void)
void OOGLWireframeModeOff (void)
void GLDrawBallBillboard (GLfloat radius, GLfloat step, GLfloat z_distance)
static void GLDrawOvalPoints (GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
void GLDrawOval (GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
void GLDrawFilledOval (GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
void GLDrawPoints (OOGLVector *points, int n)
void GLDrawFilledPoints (OOGLVector *points, int n)
void GLDrawQuadStrip (OOGLVector *points, int n)
void GLScaledLineWidth (GLfloat width)
void GLScaledPointSize (GLfloat size)
GLfloat GLGetDisplayScaleFactor (void)
void GLSetDisplayScaleFactor (GLfloat factor)
static void GLDumpLightState (unsigned lightIdx)
static void GLDumpMaterialState (void)
static void GLDumpCullingState (void)
static void GLDumpFogState (void)
static void GLDumpStateFlags (void)
void LogOpenGLState (void)
NSString * OOGLColorToString (GLfloat color[4])
NSString * OOGLEnumToString (GLenum value)
NSString * OOGLFlagToString (bool value)

Variables

static NSString *const kOOLogOpenGLStateDump = @"rendering.opengl.stateDump"
static GLfloat sDisplayScaleFactor = 1.0f

Macro Definition Documentation

◆ CASE

#define CASE ( x)
Value:
case x: \
return @ #x
float x

Definition at line 467 of file OOOpenGL.m.

467#define CASE(x) \
468 case x: \
469 return @ #x

Referenced by OOGLEnumToString().

◆ COLOR_CASE

#define COLOR_CASE ( r,
g,
b,
a,
str )
Value:
do { \
if (COLOR_EQUAL(color, (r), (g), (b), (a))) \
return (str); \
} while (0)
#define COLOR_EQUAL(color, r, g, b, a)

Referenced by OOGLColorToString().

◆ COLOR_EQUAL

#define COLOR_EQUAL ( color,
r,
g,
b,
a )
Value:
(color[0] == (r) && color[1] == (g) && color[2] == (b) && color[3] == (a))

◆ DUMP_GET_FLAG

#define DUMP_GET_FLAG ( x)
Value:
do { \
GLboolean flag; \
glGetBooleanv(x, &flag); \
OOLog(kOOLogOpenGLStateDump, @ #x ": %@", OOGLFlagToString(flag)); \
} while (0)
NSString * OOGLFlagToString(bool value)
Definition OOOpenGL.m:541
static NSString *const kOOLogOpenGLStateDump
Definition OOOpenGL.m:33

Referenced by GLDumpStateFlags().

◆ DUMP_STATE_FLAG

#define DUMP_STATE_FLAG ( x)
Value:
OOLog(kOOLogOpenGLStateDump, @ #x ": %@", OOGLFlagToString(glIsEnabled(x)))
#define OOLog(class, format,...)
Definition OOLogging.h:84

Referenced by GLDumpStateFlags().

Function Documentation

◆ GLDrawBallBillboard()

void GLDrawBallBillboard ( GLfloat radius,
GLfloat step,
GLfloat z_distance )

Definition at line 107 of file OOOpenGL.m.

108{
109 if (EXPECT_NOT((radius <= 0) || (step < 1)))
110 return;
111 if (EXPECT_NOT(radius >= z_distance))
112 return; // inside the sphere
113
114 GLfloat i, delta;
115 GLfloat s, c;
116 GLfloat r;
117
119
120 r = radius * z_distance / sqrt(z_distance * z_distance - radius * radius);
121 delta = step * M_PI / 180.0f; // Convert step from degrees to radians
122
123 glVertex3i(0, 0, 0);
124 for (i = 0; i < (M_PI * 2.0); i += delta) {
125 s = r * sin(i);
126 c = r * cos(i);
127 glVertex3f(s, c, 0.0);
128 }
129 glVertex3f(0.0, r, 0.0); // repeat the zero value to close
130}
#define EXPECT_NOT(x)
#define OO_ENTER_OPENGL()
#define M_PI
Definition OOMaths.h:54

References EXPECT_NOT, M_PI, and OO_ENTER_OPENGL.

Referenced by OOQuiriumCascadeEntity::drawImmediate:translucent:, WormholeEntity::drawImmediate:translucent:, and OOSunEntity(Private)::drawOpaqueParts.

Here is the caller graph for this function:

◆ GLDrawFilledOval()

void GLDrawFilledOval ( GLfloat x,
GLfloat y,
GLfloat z,
NSSize siz,
GLfloat step )

Definition at line 158 of file OOOpenGL.m.

159{
161
162 OOGLBEGIN(GL_TRIANGLE_FAN);
163 GLDrawOvalPoints(x, y, z, siz, step);
164 OOGLEND();
165}
#define OOGLBEGIN
Definition OOOpenGL.h:269
#define OOGLEND
Definition OOOpenGL.h:270
static void GLDrawOvalPoints(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
Definition OOOpenGL.m:132
float y

References GLDrawOvalPoints(), OO_ENTER_OPENGL, OOGLBEGIN, OOGLEND, x, and y.

Referenced by HeadUpDisplay(Private)::drawCompassPlanetBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassSunBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawScanner:, GuiDisplayGen(Internal)::drawStarChart:y:z:alpha:compact:, HeadUpDisplay(Private)::drawStickSensitivityIndicator:, and StickProfileScreen(StickProfileInternal)::graphProfile:at:size:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLDrawFilledPoints()

void GLDrawFilledPoints ( OOGLVector * points,
int n )

Definition at line 180 of file OOOpenGL.m.

181{
182 int i;
184 OOGLBEGIN(GL_TRIANGLE_FAN);
185 for (i = 0; i < n; i++) {
186 glVertex3f(points->x, points->y, points->z);
187 points++;
188 }
189 OOGLEND();
190 return;
191}
GLfloat y
Definition OOOpenGL.h:199
GLfloat x
Definition OOOpenGL.h:198
GLfloat z
Definition OOOpenGL.h:200

References OO_ENTER_OPENGL, OOGLBEGIN, OOGLEND, OOGLVector::x, OOGLVector::y, and OOGLVector::z.

◆ GLDrawOval()

void GLDrawOval ( GLfloat x,
GLfloat y,
GLfloat z,
NSSize siz,
GLfloat step )

Definition at line 149 of file OOOpenGL.m.

150{
152
153 OOGLBEGIN(GL_LINE_STRIP);
154 GLDrawOvalPoints(x, y, z, siz, step);
155 OOGLEND();
156}

References GLDrawOvalPoints(), OO_ENTER_OPENGL, OOGLBEGIN, OOGLEND, x, and y.

Referenced by HeadUpDisplay(Private)::drawCompass:, HeadUpDisplay(Private)::drawCompassPlanetBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassSunBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassTargetBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawScanner:, HeadUpDisplay::drawScannerGrid, GuiDisplayGen(Internal)::drawStarChart:y:z:alpha:compact:, and HeadUpDisplay(Private)::drawStickSensitivityIndicator:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLDrawOvalPoints()

void GLDrawOvalPoints ( GLfloat x,
GLfloat y,
GLfloat z,
NSSize siz,
GLfloat step )
static

Definition at line 132 of file OOOpenGL.m.

133{
134 GLfloat ww = 0.5 * siz.width;
135 GLfloat hh = 0.5 * siz.height;
136 GLfloat theta;
137 GLfloat delta;
138
140
141 delta = step * M_PI / 180.0f;
142
143 for (theta = 0.0f; theta < (2.0f * M_PI); theta += delta) {
144 glVertex3f(x + ww * sin(theta), y + hh * cos(theta), z);
145 }
146 glVertex3f(x, y + hh, z);
147}

References M_PI, OO_ENTER_OPENGL, x, and y.

Referenced by GLDrawFilledOval(), and GLDrawOval().

Here is the caller graph for this function:

◆ GLDrawPoints()

void GLDrawPoints ( OOGLVector * points,
int n )

Definition at line 167 of file OOOpenGL.m.

168{
169 int i;
171 OOGLBEGIN(GL_LINE_STRIP);
172 for (i = 0; i < n; i++) {
173 glVertex3f(points->x, points->y, points->z);
174 points++;
175 }
176 OOGLEND();
177 return;
178}

References OO_ENTER_OPENGL, OOGLBEGIN, OOGLEND, OOGLVector::x, OOGLVector::y, and OOGLVector::z.

Referenced by HeadUpDisplay::GLDrawNonlinearCascadeWeapon.

Here is the caller graph for this function:

◆ GLDrawQuadStrip()

void GLDrawQuadStrip ( OOGLVector * points,
int n )

Definition at line 193 of file OOOpenGL.m.

194{
195 int i;
197 OOGLBEGIN(GL_QUAD_STRIP);
198 for (i = 0; i < n; i++) {
199 glVertex3f(points->x, points->y, points->z);
200 points++;
201 }
202 OOGLEND();
203 return;
204}

References OO_ENTER_OPENGL, OOGLBEGIN, OOGLEND, OOGLVector::x, OOGLVector::y, and OOGLVector::z.

Referenced by HeadUpDisplay::GLDrawNonlinearCascadeWeapon.

Here is the caller graph for this function:

◆ GLDumpCullingState()

void GLDumpCullingState ( void )
static

Definition at line 380 of file OOOpenGL.m.

381{
383
384 bool enabled;
385 OOGL(enabled = glIsEnabled(GL_CULL_FACE));
386 OOLog(kOOLogOpenGLStateDump, @"Face culling: %@", OOGLFlagToString(enabled));
387 if (enabled) {
388 GLint value;
389
390 OOLogIndent();
391
392 OOGL(glGetIntegerv(GL_CULL_FACE_MODE, &value));
393 OOLog(kOOLogOpenGLStateDump, @"Cull face mode: %@", OOGLEnumToString(value));
394
395 OOGL(glGetIntegerv(GL_FRONT_FACE, &value));
396 OOLog(kOOLogOpenGLStateDump, @"Front face direction: %@", OOGLEnumToString(value));
397
398 OOLogOutdent();
399 }
400}
void OOLogOutdent(void)
Definition OOLogging.m:354
void OOLogIndent(void)
Definition OOLogging.m:345
#define OOGL(statement)
Definition OOOpenGL.h:262
NSString * OOGLEnumToString(GLenum value)
Definition OOOpenGL.m:471
NSString * OOGLFlagToString(bool value)
Definition OOOpenGL.m:541

References kOOLogOpenGLStateDump, OO_ENTER_OPENGL, OOGL, OOGLEnumToString(), OOGLFlagToString(), OOLog, OOLogIndent(), and OOLogOutdent().

Referenced by LogOpenGLState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLDumpFogState()

void GLDumpFogState ( void )
static

Definition at line 402 of file OOOpenGL.m.

403{
404 BOOL enabled;
405 GLint value;
406 GLfloat start,
407 end,
408 density,
409 index;
410 GLfloat color[4];
411
413
414 OOGL(enabled = glIsEnabled(GL_FOG));
415 OOLog(kOOLogOpenGLStateDump, @"Fog: %@", OOGLFlagToString(enabled));
416 if (enabled) {
417 OOLogIndent();
418
419 OOGL(glGetIntegerv(GL_FOG_MODE, &value));
420 OOLog(kOOLogOpenGLStateDump, @"Fog mode: %@", OOGLEnumToString(value));
421
422 OOGL(glGetFloatv(GL_FOG_COLOR, color));
423 OOLog(kOOLogOpenGLStateDump, @"Fog colour: %@", OOGLColorToString(color));
424
425 OOGL(glGetFloatv(GL_FOG_START, &start));
426 OOGL(glGetFloatv(GL_FOG_END, &end));
427 OOLog(kOOLogOpenGLStateDump, @"Fog start, end: %g, %g", start, end);
428
429 OOGL(glGetFloatv(GL_FOG_DENSITY, &density));
430 OOLog(kOOLogOpenGLStateDump, @"Fog density: %g", density);
431
432 OOGL(glGetFloatv(GL_FOG_DENSITY, &index));
433 OOLog(kOOLogOpenGLStateDump, @"Fog index: %g", index);
434
435 OOLogOutdent();
436 }
437}
NSString * OOGLColorToString(GLfloat color[4])
Definition OOOpenGL.m:270

References kOOLogOpenGLStateDump, OO_ENTER_OPENGL, OOGL, OOGLColorToString(), OOGLEnumToString(), OOGLFlagToString(), OOLog, OOLogIndent(), and OOLogOutdent().

Referenced by LogOpenGLState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLDumpLightState()

void GLDumpLightState ( unsigned lightIdx)
static

Definition at line 292 of file OOOpenGL.m.

293{
294 BOOL enabled;
295 GLenum lightID = GL_LIGHT0 + lightIdx;
296 GLfloat color[4];
297
299
300 OOGL(enabled = glIsEnabled(lightID));
301 OOLog(kOOLogOpenGLStateDump, @"Light %u: %@", lightIdx, OOGLFlagToString(enabled));
302
303 if (enabled) {
304 OOLogIndent();
305
306 OOGL(glGetLightfv(GL_LIGHT1, GL_AMBIENT, color));
307 OOLog(kOOLogOpenGLStateDump, @"Ambient: %@", OOGLColorToString(color));
308 OOGL(glGetLightfv(GL_LIGHT1, GL_DIFFUSE, color));
309 OOLog(kOOLogOpenGLStateDump, @"Diffuse: %@", OOGLColorToString(color));
310 OOGL(glGetLightfv(GL_LIGHT1, GL_SPECULAR, color));
311 OOLog(kOOLogOpenGLStateDump, @"Specular: %@", OOGLColorToString(color));
312
313 OOLogOutdent();
314 }
315}

References kOOLogOpenGLStateDump, OO_ENTER_OPENGL, OOGL, OOGLColorToString(), OOGLFlagToString(), OOLog, OOLogIndent(), and OOLogOutdent().

Referenced by LogOpenGLState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLDumpMaterialState()

void GLDumpMaterialState ( void )
static

Definition at line 317 of file OOOpenGL.m.

318{
319 GLfloat color[4];
320 GLfloat shininess;
321 GLint shadeModel,
322 blendSrc,
323 blendDst,
324 texMode;
325 BOOL blending;
326
328
329 OOLog(kOOLogOpenGLStateDump, @"%@", @"Material state:");
330 OOLogIndent();
331
332 OOGL(glGetMaterialfv(GL_FRONT, GL_AMBIENT, color));
333 OOLog(kOOLogOpenGLStateDump, @"Ambient: %@", OOGLColorToString(color));
334
335 OOGL(glGetMaterialfv(GL_FRONT, GL_DIFFUSE, color));
336 OOLog(kOOLogOpenGLStateDump, @"Diffuse: %@", OOGLColorToString(color));
337
338 OOGL(glGetMaterialfv(GL_FRONT, GL_EMISSION, color));
339 OOLog(kOOLogOpenGLStateDump, @"Emission: %@", OOGLColorToString(color));
340
341 OOGL(glGetMaterialfv(GL_FRONT, GL_SPECULAR, color));
342 OOLog(kOOLogOpenGLStateDump, @"Specular: %@", OOGLColorToString(color));
343
344 OOGL(glGetMaterialfv(GL_FRONT, GL_SHININESS, &shininess));
345 OOLog(kOOLogOpenGLStateDump, @"Shininess: %g", shininess);
346
347 OOGL(OOLog(kOOLogOpenGLStateDump, @"Colour material: %@", OOGLFlagToString(glIsEnabled(GL_COLOR_MATERIAL))));
348
349 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
350 OOLog(kOOLogOpenGLStateDump, @"Current color: %@", OOGLColorToString(color));
351
352 OOGL(glGetIntegerv(GL_SHADE_MODEL, &shadeModel));
353 OOLog(kOOLogOpenGLStateDump, @"Shade model: %@", OOGLEnumToString(shadeModel));
354
355 OOGL(blending = glIsEnabled(GL_BLEND));
356 OOLog(kOOLogOpenGLStateDump, @"Blending: %@", OOGLFlagToString(blending));
357 if (blending) {
358 OOGL(glGetIntegerv(GL_BLEND_SRC, &blendSrc));
359 OOGL(glGetIntegerv(GL_BLEND_DST, &blendDst));
360 OOLog(kOOLogOpenGLStateDump, @"Blend function: %@, %@", OOGLEnumToString(blendSrc), OOGLEnumToString(blendDst));
361 }
362
363 OOGL(glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &texMode));
364 OOLog(kOOLogOpenGLStateDump, @"Texture env mode: %@", OOGLEnumToString(texMode));
365
366#if OO_MULTITEXTURE
367 if ([[OOOpenGLExtensionManager sharedManager] textureUnitCount] > 1) {
368 GLint textureUnit;
369 OOGL(glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &textureUnit));
370 OOLog(kOOLogOpenGLStateDump, @"Active texture unit: %@", OOGLEnumToString(textureUnit));
371
372 OOGL(glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE_ARB, &textureUnit));
373 OOLog(kOOLogOpenGLStateDump, @"Active client texture unit: %@", OOGLEnumToString(textureUnit));
374 }
375#endif
376
377 OOLogOutdent();
378}

References kOOLogOpenGLStateDump, OO_ENTER_OPENGL, OOGL, OOGLColorToString(), OOGLEnumToString(), OOGLFlagToString(), OOLog, OOLogIndent(), and OOLogOutdent().

Referenced by LogOpenGLState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLDumpStateFlags()

void GLDumpStateFlags ( void )
static

Definition at line 439 of file OOOpenGL.m.

440{
442
443#define DUMP_STATE_FLAG(x) OOLog(kOOLogOpenGLStateDump, @ #x ": %@", OOGLFlagToString(glIsEnabled(x)))
444#define DUMP_GET_FLAG(x) \
445 do { \
446 GLboolean flag; \
447 glGetBooleanv(x, &flag); \
448 OOLog(kOOLogOpenGLStateDump, @ #x ": %@", OOGLFlagToString(flag)); \
449 } while (0)
450
451 OOLog(kOOLogOpenGLStateDump, @"%@", @"Selected state flags:");
452 OOLogIndent();
453
454 DUMP_STATE_FLAG(GL_VERTEX_ARRAY);
455 DUMP_STATE_FLAG(GL_NORMAL_ARRAY);
456 DUMP_STATE_FLAG(GL_TEXTURE_COORD_ARRAY);
457 DUMP_STATE_FLAG(GL_COLOR_ARRAY);
458 DUMP_STATE_FLAG(GL_TEXTURE_2D);
459 DUMP_STATE_FLAG(GL_DEPTH_TEST);
460 DUMP_GET_FLAG(GL_DEPTH_WRITEMASK);
461
462 OOLogOutdent();
463
464#undef DUMP_STATE_FLAG
465}
#define DUMP_GET_FLAG(x)
#define DUMP_STATE_FLAG(x)

References DUMP_GET_FLAG, DUMP_STATE_FLAG, kOOLogOpenGLStateDump, OO_ENTER_OPENGL, OOLog, OOLogIndent(), and OOLogOutdent().

Referenced by LogOpenGLState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GLGetDisplayScaleFactor()

GLfloat GLGetDisplayScaleFactor ( void )

Definition at line 218 of file OOOpenGL.m.

219{
220 return sDisplayScaleFactor;
221}
static GLfloat sDisplayScaleFactor
Definition OOOpenGL.m:36

References sDisplayScaleFactor.

◆ GLScaledLineWidth()

◆ GLScaledPointSize()

void GLScaledPointSize ( GLfloat size)

Definition at line 212 of file OOOpenGL.m.

213{
215 glPointSize(size * sDisplayScaleFactor);
216}
voidpf void uLong size
Definition ioapi.h:126

References OO_ENTER_OPENGL, and sDisplayScaleFactor.

Referenced by DustEntity::drawImmediate:translucent:.

Here is the caller graph for this function:

◆ GLSetDisplayScaleFactor()

void GLSetDisplayScaleFactor ( GLfloat factor)

Definition at line 223 of file OOOpenGL.m.

224{
225 NSCParameterAssert(factor >= 0.0f && isfinite(factor));
226 sDisplayScaleFactor = factor;
227}

References sDisplayScaleFactor.

◆ LogOpenGLState()

void LogOpenGLState ( void )

Definition at line 239 of file OOOpenGL.m.

240{
241 unsigned i;
242
244 return;
245
247
248 OOLog(kOOLogOpenGLStateDump, @"%@", @"OpenGL state dump:");
249 OOLogIndent();
250
253 if (glIsEnabled(GL_LIGHTING)) {
254 OOLog(kOOLogOpenGLStateDump, @"%@", @"Lighting: ENABLED");
255 for (i = 0; i != 8; ++i) {
257 }
258 } else {
259 OOLog(kOOLogOpenGLStateDump, @"%@", @"Lighting: disabled");
260 }
261
264
265 OOCheckOpenGLErrors(@"After state dump");
266
267 OOLogOutdent();
268}
BOOL OOLogWillDisplayMessagesInClass(NSString *inMessageClass)
Definition OOLogging.m:136
static void GLDumpMaterialState(void)
Definition OOOpenGL.m:317
static void GLDumpStateFlags(void)
Definition OOOpenGL.m:439
static void GLDumpCullingState(void)
Definition OOOpenGL.m:380
static void GLDumpLightState(unsigned lightIdx)
Definition OOOpenGL.m:292
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:38
static void GLDumpFogState(void)
Definition OOOpenGL.m:402

References GLDumpCullingState(), GLDumpFogState(), GLDumpLightState(), GLDumpMaterialState(), GLDumpStateFlags(), kOOLogOpenGLStateDump, OO_ENTER_OPENGL, OOCheckOpenGLErrors(), OOLog, OOLogIndent(), OOLogOutdent(), and OOLogWillDisplayMessagesInClass().

Referenced by OOCheckOpenGLErrors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OOCheckOpenGLErrors()

BOOL OOCheckOpenGLErrors ( NSString * format,
... )

Definition at line 38 of file OOOpenGL.m.

39{
40 GLenum errCode;
41 const GLubyte* errString = NULL;
42 BOOL errorOccurred = NO;
43 va_list args;
44 static BOOL noReenter;
45
46 if (noReenter)
47 return NO;
48 noReenter = YES;
49
51
52 // Short-circut here, because glGetError() is quite expensive.
54 for (;;) {
55 errCode = glGetError();
56
57 if (errCode == GL_NO_ERROR)
58 break;
59
60 errorOccurred = YES;
61 errString = gluErrorString(errCode);
62 if (format == nil)
63 format = @"<unknown>";
64
65 va_start(args, format);
66 format = [[[NSString alloc] initWithFormat:format arguments:args] autorelease];
67 va_end(args);
68 OOLog(kOOLogOpenGLError, @"OpenGL error: \"%s\" (%#x), context: %@", errString, errCode, format);
69 }
70 }
71
72#if OO_CHECK_GL_HEAVY
73 if (errorOccurred) {
77 while (glGetError() != 0) { } // Suppress any errors caused by LogOpenGLState().
78 }
79#endif
80
81 noReenter = NO;
82 return errorOccurred;
83}
NSString *const kOOLogOpenGLError
Definition OOLogging.m:603
void LogOpenGLState(void)
Definition OOOpenGL.m:239
return nil

References kOOLogOpenGLError, LogOpenGLState(), nil, OO_ENTER_OPENGL, OOLog, OOLogIndent(), OOLogOutdent(), and OOLogWillDisplayMessagesInClass().

Referenced by HeadUpDisplay(Private)::drawHUDItem:, DustEntity::drawImmediate:translucent:, OOBreakPatternEntity::drawImmediate:translucent:, OOLaserShotEntity::drawImmediate:translucent:, OOParticleSystem::drawImmediate:translucent:, OOQuiriumCascadeEntity::drawImmediate:translucent:, OORingEffectEntity::drawImmediate:translucent:, SkyEntity::drawImmediate:translucent:, WormholeEntity::drawImmediate:translucent:, OOSunEntity(Private)::drawOpaqueParts, PlanetEntity::drawUnconditionally, Universe::drawUniverse, OOPolygonSprite::drawWithData:count:VBO:, LogOpenGLState(), OOCrosshairs::render, HeadUpDisplay::renderHUD, OOMesh::renderOpaqueParts, and OOSkyDrawable::renderOpaqueParts.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OOGLColorToString()

NSString * OOGLColorToString ( GLfloat color[4])

Definition at line 270 of file OOOpenGL.m.

271{
272#define COLOR_EQUAL(color, r, g, b, a) (color[0] == (r) && color[1] == (g) && color[2] == (b) && color[3] == (a))
273#define COLOR_CASE(r, g, b, a, str) \
274 do { \
275 if (COLOR_EQUAL(color, (r), (g), (b), (a))) \
276 return (str); \
277 } while (0)
278
279 COLOR_CASE(1, 1, 1, 1, @"white");
280 COLOR_CASE(0, 0, 0, 1, @"black");
281 COLOR_CASE(0, 0, 0, 0, @"clear");
282 COLOR_CASE(1, 0, 0, 1, @"red");
283 COLOR_CASE(0, 1, 0, 1, @"green");
284 COLOR_CASE(0, 0, 1, 1, @"blue");
285 COLOR_CASE(0, 1, 1, 1, @"cyan");
286 COLOR_CASE(1, 0, 1, 1, @"magenta");
287 COLOR_CASE(1, 1, 0, 1, @"yellow");
288
289 return [NSString stringWithFormat:@"(%.2ff, %.2ff, %.2ff, %.2ff)", color[0], color[1], color[2], color[3]];
290}
#define COLOR_CASE(r, g, b, a, str)

References COLOR_CASE.

Referenced by GLDumpFogState(), GLDumpLightState(), and GLDumpMaterialState().

Here is the caller graph for this function:

◆ OOGLEnumToString()

NSString * OOGLEnumToString ( GLenum value)

Definition at line 471 of file OOOpenGL.m.

472{
473 switch (value) {
474 // ShadingModel
475 CASE(GL_FLAT);
476 CASE(GL_SMOOTH);
477
478 // BlendingFactorSrc/BlendingFactorDest
479 CASE(GL_ZERO);
480 CASE(GL_ONE);
481 CASE(GL_DST_COLOR);
482 CASE(GL_SRC_COLOR);
483 CASE(GL_ONE_MINUS_DST_COLOR);
484 CASE(GL_ONE_MINUS_SRC_COLOR);
485 CASE(GL_SRC_ALPHA);
486 CASE(GL_DST_ALPHA);
487 CASE(GL_ONE_MINUS_SRC_ALPHA);
488 CASE(GL_ONE_MINUS_DST_ALPHA);
489 CASE(GL_SRC_ALPHA_SATURATE);
490
491 // TextureEnvMode
492 CASE(GL_MODULATE);
493 CASE(GL_DECAL);
494 CASE(GL_BLEND);
495 CASE(GL_REPLACE);
496
497 // FrontFaceDirection
498 CASE(GL_CW);
499 CASE(GL_CCW);
500
501 // CullFaceMode
502 CASE(GL_FRONT);
503 CASE(GL_BACK);
504 CASE(GL_FRONT_AND_BACK);
505
506 // FogMode
507 CASE(GL_LINEAR);
508 CASE(GL_EXP);
509 CASE(GL_EXP2);
510
511#if OO_MULTITEXTURE
512 // Texture units
513#ifdef GL_TEXTURE0
514#define TEXCASE CASE
515#else
516#define TEXCASE(x) CASE(x##_ARB)
517#endif
518 TEXCASE(GL_TEXTURE0);
519 TEXCASE(GL_TEXTURE1);
520 TEXCASE(GL_TEXTURE2);
521 TEXCASE(GL_TEXTURE3);
522 TEXCASE(GL_TEXTURE4);
523 TEXCASE(GL_TEXTURE5);
524 TEXCASE(GL_TEXTURE6);
525 TEXCASE(GL_TEXTURE7);
526 TEXCASE(GL_TEXTURE8);
527 TEXCASE(GL_TEXTURE9);
528 TEXCASE(GL_TEXTURE10);
529 TEXCASE(GL_TEXTURE11);
530 TEXCASE(GL_TEXTURE12);
531 TEXCASE(GL_TEXTURE13);
532 TEXCASE(GL_TEXTURE14);
533 TEXCASE(GL_TEXTURE15);
534#endif
535
536 default:
537 return [NSString stringWithFormat:@"unknown: %u", value];
538 }
539}
#define CASE(x)
Definition OOOpenGL.m:467

References CASE.

Referenced by GLDumpCullingState(), GLDumpFogState(), GLDumpMaterialState(), and VerifyOpenGLStateInternal().

Here is the caller graph for this function:

◆ OOGLFlagToString()

NSString * OOGLFlagToString ( bool value)

Definition at line 541 of file OOOpenGL.m.

542{
543 return value ? @"ENABLED" : @"disabled";
544}

Referenced by GLDumpCullingState(), GLDumpFogState(), GLDumpLightState(), and GLDumpMaterialState().

Here is the caller graph for this function:

◆ OOGLWireframeModeOff()

void OOGLWireframeModeOff ( void )

Definition at line 100 of file OOOpenGL.m.

101{
103 OOGL(glPolygonMode(GL_FRONT_AND_BACK, GL_FILL));
104 // OOGL(glPopAttrib());
105}

References OO_ENTER_OPENGL, and OOGL.

Referenced by OOEntityWithDrawable::drawImmediate:translucent:, and PlanetEntity::drawUnconditionally.

Here is the caller graph for this function:

◆ OOGLWireframeModeOn()

void OOGLWireframeModeOn ( void )

Definition at line 85 of file OOOpenGL.m.

86{
88
89 /* Because of where this is called relative to the
90 * OpenGLStateManager methods, pushAttrib/popAttrib causes the
91 * OpenGL state to move away from where it should be. So, instead,
92 * just switch polygon mode as needed. Linewidth is set already by
93 * everything that needs it and not handled by the state
94 * manager. - CIM*/
95 // OOGL(glPushAttrib(GL_POLYGON_BIT | GL_LINE_BIT | GL_TEXTURE_BIT));
97 OOGL(glPolygonMode(GL_FRONT_AND_BACK, GL_LINE));
98}
void GLScaledLineWidth(GLfloat width)
Definition OOOpenGL.m:206

References GLScaledLineWidth(), OO_ENTER_OPENGL, and OOGL.

Referenced by OOEntityWithDrawable::drawImmediate:translucent:, and PlanetEntity::drawUnconditionally.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kOOLogOpenGLStateDump

NSString* const kOOLogOpenGLStateDump = @"rendering.opengl.stateDump"
static

◆ sDisplayScaleFactor

GLfloat sDisplayScaleFactor = 1.0f
static