Oolite
Loading...
Searching...
No Matches
OOOpenGL.h File Reference
import "OOFoundation.h"
import "OOOpenGLOnly.h"
Include dependency graph for OOOpenGL.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  OOGLVector

Macros

#define NULL_SHADER   ((GLhandleARB)0)
#define OOGLProgramName(handle)
#define OO_GL_STATE_VERIFICATION   1
#define OOSetOpenGLState(STATE)
#define OOVerifyOpenGLState()
#define OO_CHECK_GL_HEAVY   0
#define OOGL(statement)
#define CheckOpenGLErrorsHeavy(...)
#define OOGLBEGIN   glBegin
#define OOGLEND   glEnd

Enumerations

enum  OOShaderSetting { SHADERS_NOT_SUPPORTED = 0 , SHADERS_OFF = 1 , SHADERS_SIMPLE = 2 , SHADERS_FULL = 3 }
enum  OOOpenGLStateID {
  OPENGL_STATE_OPAQUE , OPENGL_STATE_TRANSLUCENT_PASS , OPENGL_STATE_ADDITIVE_BLENDING , OPENGL_STATE_OVERLAY ,
  OPENGL_STATE_INTERNAL_USE_ONLY
}
enum  { kOOShaderSettingDefault = SHADERS_NOT_SUPPORTED }

Functions

void OOSetOpenGLState_ (OOOpenGLStateID state, const char *function, unsigned line)
void OOVerifyOpenGLState_ (const char *function, unsigned line)
void OOResetGLStateVerifier (void)
BOOL OOCheckOpenGLErrors (NSString *format,...)
void LogOpenGLState (void)
void GLScaledLineWidth (GLfloat width)
void GLScaledPointSize (GLfloat size)
GLfloat GLGetDisplayScaleFactor (void)
void GLSetDisplayScaleFactor (GLfloat factor)
void OOGLWireframeModeOn (void)
void OOGLWireframeModeOff (void)
void GLDrawBallBillboard (GLfloat radius, GLfloat step, GLfloat z_distance)
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)
OOShaderSetting OOShaderSettingFromString (NSString *string)
NSString * OOStringFromShaderSetting (OOShaderSetting setting)
NSString * OODisplayStringFromShaderSetting (OOShaderSetting setting)
NSString * OOGLColorToString (GLfloat color[4])
NSString * OOGLEnumToString (GLenum value)
NSString * OOGLFlagToString (bool value)

Macro Definition Documentation

◆ CheckOpenGLErrorsHeavy

#define CheckOpenGLErrorsHeavy ( ...)
Value:
do { \
} while (0)

Definition at line 266 of file OOOpenGL.h.

266#define CheckOpenGLErrorsHeavy(...) \
267 do { \
268 } while (0)

◆ NULL_SHADER

#define NULL_SHADER   ((GLhandleARB)0)

Definition at line 41 of file OOOpenGL.h.

◆ OO_CHECK_GL_HEAVY

#define OO_CHECK_GL_HEAVY   0

Definition at line 224 of file OOOpenGL.h.

◆ OO_GL_STATE_VERIFICATION

#define OO_GL_STATE_VERIFICATION   1

Definition at line 50 of file OOOpenGL.h.

◆ OOGL

#define OOGL ( statement)
Value:
do { \
statement; \
} while (0)

Definition at line 262 of file OOOpenGL.h.

262#define OOGL(statement) \
263 do { \
264 statement; \
265 } while (0)

Referenced by OOConcreteTexture::apply, OOTexture::applyNone, OOTextureSprite::blitToX:Y:Z:alpha:, OOTexture::checkExtensions, OOConcreteTexture::dealloc, OOMesh(Private)::deleteDisplayLists, Universe(OOPrivate)::deleteOpenGLObjects, OOBasicMaterial::doApply, GuiDisplayGen(Internal)::drawAdvancedNavArrayAtX:y:z:alpha:usingRoute:optimizedBy:zoom:, HeadUpDisplay(Private)::drawAegis:, HeadUpDisplay(Private)::drawASCTarget:, HeadUpDisplay(Private)::drawClock:, HeadUpDisplay(Private)::drawCompass:, HeadUpDisplay(Private)::drawCompassPlanetBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassSunBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCustomLight:, OOSunEntity::drawDirectVisionSunGlare, HeadUpDisplay(Private)::drawFPSInfoCounter:, GuiDisplayGen(Internal)::drawGLDisplay:y:z:alpha:, GuiDisplayGen::drawGUI:drawCursor:, HeadUpDisplay::drawHighlight, DustEntity::drawImmediate:translucent:, OOBreakPatternEntity::drawImmediate:translucent:, OOLaserShotEntity::drawImmediate:translucent:, OOLightParticleEntity::drawImmediate:translucent:, OOParticleSystem::drawImmediate:translucent:, OOQuiriumCascadeEntity::drawImmediate:translucent:, OOWaypointEntity::drawImmediate:translucent:, WormholeEntity::drawImmediate:translucent:, Universe::drawMessage, PlanetEntity(OOPrivate)::drawModelWithVertexArraysAndSubdivision:, OOSunEntity(Private)::drawOpaqueParts, HeadUpDisplay::drawPrimedEquipment:, HeadUpDisplay(Private)::drawScanner:, HeadUpDisplay::drawScannerGrid, HeadUpDisplay(Private)::drawScannerZoomIndicator:, HeadUpDisplay(Private)::drawScoopStatus:, GuiDisplayGen(Internal)::drawStarChart:y:z:alpha:compact:, OOSunEntity::drawStarGlare, HeadUpDisplay(Private)::drawStatusLight:, HeadUpDisplay(Private)::drawStickSensitivityIndicator:, OOExhaustPlumeEntity::drawSubEntityImmediate:translucent:, GuiDisplayGen(Internal)::drawSystemMarker:atX:andY:andZ:withAlpha:andScale:, Universe(OOPrivate)::drawTargetTextureIntoDefaultFramebuffer, OOSunEntity(Private)::drawTranslucentParts, OOTrumble::drawTrumble:, PlanetEntity::drawUnconditionally, Universe::drawUniverse, Universe::drawWatermarkString:, HeadUpDisplay(Private)::drawWeaponsOfflineText:, OOPolygonSprite::drawWithData:count:VBO:, OOConcreteTexture(Private)::forceRebind, GetCurrentOpenGLState(), GetState_DEPTH_WRITEMASK(), GetState_TEXTURE_ENV_MODE(), HeadUpDisplay::GLDrawNonlinearCascadeWeapon, GLDumpCullingState(), GLDumpFogState(), GLDumpLightState(), GLDumpMaterialState(), GLUniformMatrix3(), StickProfileScreen(StickProfileInternal)::graphProfile:at:size:, Universe(OOPrivate)::initTargetFramebufferWithViewSize:, Universe::lightForEntity:, HeadUpDisplay::OODrawHilightedPlanetInfo, HeadUpDisplay::OODrawHilightedString, HeadUpDisplay::OODrawPlanetInfo, OOGLWireframeModeOff(), OOGLWireframeModeOn(), HeadUpDisplay::OOStartDrawingStrings, HeadUpDisplay::OOStopDrawingStrings, Universe(OOPrivate)::prepareToRenderIntoDefaultFramebuffer, OOCrosshairs::render, OOSkyQuadSet::render, HeadUpDisplay::renderHUD, OOMesh::renderOpaqueParts, OOSkyDrawable::renderOpaqueParts, OOGraphicsResetManager::resetGraphicsState, Universe(OOPrivate)::resizeTargetFramebufferWithViewSize:, HeadUpDisplay::SetCompassBlipColor, GuiDisplayGen::setGLColorFromSetting:defaultValue:alpha:, Universe::setLighting, SetState_CULL_FACE_MODE(), OOSunEntity::setSunColor:, OOTextureLoader::setUp, MyOpenGLView::setUpBasicOpenGLStateWithSize, MyOpenGLView::snapShot:, SwitchOpenGLStateInternal(), OOOpenGLMatrixManager::syncModelView, OOOpenGLMatrixManager::syncProjection, MyOpenGLView::updateGLSize:, OOConcreteTexture(Private)::uploadTexture, OOConcreteTexture(Private)::uploadTextureDataWithMipMap:format:, and Universe::useGUILightSource:.

◆ OOGLBEGIN

#define OOGLBEGIN   glBegin

Definition at line 269 of file OOOpenGL.h.

Referenced by OOTextureSprite::blitToX:Y:Z:alpha:, GuiDisplayGen(Internal)::drawAdvancedNavArrayAtX:y:z:alpha:usingRoute:optimizedBy:zoom:, HeadUpDisplay(Private)::drawAegis:, HeadUpDisplay(Private)::drawCompass:, HeadUpDisplay(Private)::drawCompassBeaconBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassStationBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassTargetBlipAt:Size:Alpha:, GuiDisplayGen(Internal)::drawCrossHairsWithSize:x:y:z:, HeadUpDisplay(Private)::drawCustomLight:, HeadUpDisplay(Private)::drawDirectionCue:, OOSunEntity::drawDirectVisionSunGlare, GuiDisplayGen(Internal)::drawGLDisplay:y:z:alpha:, GuiDisplayGen::drawGUI:drawCursor:, HeadUpDisplay::drawHighlight, OOLightParticleEntity::drawImmediate:translucent:, OOParticleSystem::drawImmediate:translucent:, OOQuiriumCascadeEntity::drawImmediate:translucent:, OORingEffectEntity::drawImmediate:translucent:, OOWaypointEntity::drawImmediate:translucent:, WormholeEntity::drawImmediate:translucent:, HeadUpDisplay(Private)::drawMissileDisplay:, HeadUpDisplay(Private)::drawMultiFunctionDisplay:withText:asIndex:, OOSunEntity(Private)::drawOpaqueParts, HeadUpDisplay(Private)::drawScanner:, HeadUpDisplay::drawScannerGrid, HeadUpDisplay(Private)::drawScannerZoomIndicator:, HeadUpDisplay(Private)::drawScoopStatus:, HeadUpDisplay::DrawSpecialOval, GuiDisplayGen(Internal)::drawStarChart:y:z:alpha:compact:, OOSunEntity::drawStarGlare, HeadUpDisplay(Private)::drawStatusLight:, GuiDisplayGen(Internal)::drawSystemMarker:atX:andY:andZ:withAlpha:andScale:, OOTrumble::drawTrumble:, WormholeEntity::DrawWormholeCorona, GLDrawFilledOval(), GLDrawFilledPoints(), GLDrawOval(), GLDrawPoints(), GLDrawQuadStrip(), StickProfileScreen(StickProfileInternal)::graphProfile:at:size:, HeadUpDisplay::hudDrawBarAt, HeadUpDisplay::hudDrawIndicatorAt, HeadUpDisplay::hudDrawMarkerAt, HeadUpDisplay::hudDrawReticleOnTarget, HeadUpDisplay::hudDrawSurroundAt, HeadUpDisplay::hudDrawWaypoint, HeadUpDisplay::OODrawPlanetInfo, and HeadUpDisplay::OOStartDrawingStrings.

◆ OOGLEND

#define OOGLEND   glEnd

Definition at line 270 of file OOOpenGL.h.

Referenced by OOTextureSprite::blitToX:Y:Z:alpha:, GuiDisplayGen(Internal)::drawAdvancedNavArrayAtX:y:z:alpha:usingRoute:optimizedBy:zoom:, HeadUpDisplay(Private)::drawAegis:, HeadUpDisplay(Private)::drawCompass:, HeadUpDisplay(Private)::drawCompassBeaconBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassStationBlipAt:Size:Alpha:, HeadUpDisplay(Private)::drawCompassTargetBlipAt:Size:Alpha:, GuiDisplayGen(Internal)::drawCrossHairsWithSize:x:y:z:, HeadUpDisplay(Private)::drawCustomLight:, HeadUpDisplay(Private)::drawDirectionCue:, OOSunEntity::drawDirectVisionSunGlare, GuiDisplayGen(Internal)::drawGLDisplay:y:z:alpha:, GuiDisplayGen::drawGUI:drawCursor:, HeadUpDisplay::drawHighlight, OOLightParticleEntity::drawImmediate:translucent:, OOParticleSystem::drawImmediate:translucent:, OOQuiriumCascadeEntity::drawImmediate:translucent:, OORingEffectEntity::drawImmediate:translucent:, OOWaypointEntity::drawImmediate:translucent:, WormholeEntity::drawImmediate:translucent:, HeadUpDisplay(Private)::drawMissileDisplay:, HeadUpDisplay(Private)::drawMultiFunctionDisplay:withText:asIndex:, OOSunEntity(Private)::drawOpaqueParts, HeadUpDisplay(Private)::drawScanner:, HeadUpDisplay::drawScannerGrid, HeadUpDisplay(Private)::drawScannerZoomIndicator:, HeadUpDisplay(Private)::drawScoopStatus:, HeadUpDisplay::DrawSpecialOval, GuiDisplayGen(Internal)::drawStarChart:y:z:alpha:compact:, OOSunEntity::drawStarGlare, HeadUpDisplay(Private)::drawStatusLight:, GuiDisplayGen(Internal)::drawSystemMarker:atX:andY:andZ:withAlpha:andScale:, OOTrumble::drawTrumble:, WormholeEntity::DrawWormholeCorona, GLDrawFilledOval(), GLDrawFilledPoints(), GLDrawOval(), GLDrawPoints(), GLDrawQuadStrip(), StickProfileScreen(StickProfileInternal)::graphProfile:at:size:, HeadUpDisplay::hudDrawBarAt, HeadUpDisplay::hudDrawIndicatorAt, HeadUpDisplay::hudDrawMarkerAt, HeadUpDisplay::hudDrawReticleOnTarget, HeadUpDisplay::hudDrawSurroundAt, HeadUpDisplay::hudDrawWaypoint, HeadUpDisplay::OODrawPlanetInfo, and HeadUpDisplay::OOStopDrawingStrings.

◆ OOGLProgramName

#define OOGLProgramName ( handle)
Value:
((GLuint)(uintptr_t)(handle))

Definition at line 44 of file OOOpenGL.h.

Referenced by Universe(OOPrivate)::drawTargetTextureIntoDefaultFramebuffer.

◆ OOSetOpenGLState

◆ OOVerifyOpenGLState

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kOOShaderSettingDefault 

Definition at line 274 of file OOOpenGL.h.

274 {
276};
@ SHADERS_NOT_SUPPORTED
Definition OOOpenGL.h:35
@ kOOShaderSettingDefault
Definition OOOpenGL.h:275

◆ OOOpenGLStateID

Enumerator
OPENGL_STATE_OPAQUE 
OPENGL_STATE_TRANSLUCENT_PASS 
OPENGL_STATE_ADDITIVE_BLENDING 
OPENGL_STATE_OVERLAY 
OPENGL_STATE_INTERNAL_USE_ONLY 

Definition at line 120 of file OOOpenGL.h.

120 {
125
OOOpenGLStateID
Definition OOOpenGL.h:120
@ OPENGL_STATE_INTERNAL_USE_ONLY
Definition OOOpenGL.h:126
@ OPENGL_STATE_TRANSLUCENT_PASS
Definition OOOpenGL.h:122
@ OPENGL_STATE_ADDITIVE_BLENDING
Definition OOOpenGL.h:123
@ OPENGL_STATE_OVERLAY
Definition OOOpenGL.h:124
@ OPENGL_STATE_OPAQUE
Definition OOOpenGL.h:121

◆ OOShaderSetting

Enumerator
SHADERS_NOT_SUPPORTED 
SHADERS_OFF 
SHADERS_SIMPLE 
SHADERS_FULL 

Definition at line 33 of file OOOpenGL.h.

33 {
34 // NOTE: numerical values are available to scripts.
36 SHADERS_OFF = 1,
38 SHADERS_FULL = 3
OOShaderSetting
Definition OOOpenGL.h:33
@ SHADERS_FULL
Definition OOOpenGL.h:38
@ SHADERS_SIMPLE
Definition OOOpenGL.h:37
@ SHADERS_OFF
Definition OOOpenGL.h:36

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
float x

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:

◆ 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:

◆ 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
void OOLogOutdent(void)
Definition OOLogging.m:354
#define OOLog(class, format,...)
Definition OOLogging.h:84
void OOLogIndent(void)
Definition OOLogging.m:345
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 NSString *const kOOLogOpenGLStateDump
Definition OOOpenGL.m:33
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:

◆ OODisplayStringFromShaderSetting()

NSString * OODisplayStringFromShaderSetting ( OOShaderSetting setting)

Definition at line 434 of file OOConstToString.m.

435{
436 switch (setting) {
438 return DESC(@"shaderfx-not-available");
439 case SHADERS_OFF:
440 return DESC(@"shaderfx-off");
441 case SHADERS_SIMPLE:
442 return DESC(@"shaderfx-simple");
443 case SHADERS_FULL:
444 return DESC(@"shaderfx-full");
445 }
446
447 return @"??";
448}
#define DESC(key)
Definition Universe.h:832

References DESC, SHADERS_FULL, SHADERS_NOT_SUPPORTED, SHADERS_OFF, and SHADERS_SIMPLE.

◆ 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}
#define OOGL(statement)
Definition OOOpenGL.h:262

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:

◆ OOResetGLStateVerifier()

void OOResetGLStateVerifier ( void )

Definition at line 443 of file OOOpenGLStateManager.m.

444{
445 // State has been reset behind our backs, so to speak; don't verify.
447}
static OOOpenGLStateID sCurrentStateID

References OPENGL_STATE_INTERNAL_USE_ONLY, and sCurrentStateID.

◆ OOSetOpenGLState_()

void OOSetOpenGLState_ ( OOOpenGLStateID state,
const char * function,
unsigned line )

Definition at line 238 of file OOOpenGLStateManager.m.

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}
static const OOOpenGLState kStandardStates[OPENGL_STATE_INTERNAL_USE_ONLY+1]
static void SetFunctionTracking(bool value)
static void VerifyOpenGLStateInternal(const char *caller, const char *nominalCaller, unsigned line) NONNULL_FUNC
static void SwitchOpenGLStateInternal(const OOOpenGLState *sourceState, const OOOpenGLState *targetState) NONNULL_FUNC
static void OOGLNoteCurrentFunction(const char *function, unsigned line)

References kStandardStates, OOGLNoteCurrentFunction(), OPENGL_STATE_INTERNAL_USE_ONLY, sCurrentStateID, SetFunctionTracking(), SwitchOpenGLStateInternal(), and VerifyOpenGLStateInternal().

Here is the call graph for this function:

◆ OOShaderSettingFromString()

OOShaderSetting OOShaderSettingFromString ( NSString * string)

Definition at line 462 of file OOConstToString.m.

References kOOShaderSettingDefault, REVERSE_CASE, SHADERS_FULL, SHADERS_NOT_SUPPORTED, SHADERS_OFF, and SHADERS_SIMPLE.

Referenced by OOOpenGLExtensionManager::reset.

Here is the caller graph for this function:

◆ OOStringFromShaderSetting()

NSString * OOStringFromShaderSetting ( OOShaderSetting setting)

Definition at line 450 of file OOConstToString.m.

451{
452 switch (setting) {
457 }
458
459 return @"UNDEFINED";
460}
#define CASE(foo)

References CASE, SHADERS_FULL, SHADERS_NOT_SUPPORTED, SHADERS_OFF, and SHADERS_SIMPLE.

◆ OOVerifyOpenGLState_()

void OOVerifyOpenGLState_ ( const char * function,
unsigned line )

Definition at line 255 of file OOOpenGLStateManager.m.

256{
257 OOGLNoteCurrentFunction(function, line);
258 SetFunctionTracking(false);
259
260 VerifyOpenGLStateInternal("OOVerifyOpenGLState", function, line);
261
263}

References OOGLNoteCurrentFunction(), SetFunctionTracking(), and VerifyOpenGLStateInternal().

Here is the call graph for this function: