Defines | Functions

CC3OpenGLES11Foundation.h File Reference

#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import "CC3OpenGLES11Intercept.h"

Defines

#define GL_ERROR_LOGGING_ENABLED   0
#define GL_ERROR_TRACING_ENABLED   0

Functions

void DoLogGLErrorState (NSString *fmt,...)
NSString * GetGLErrorText (GLenum errCode)
NSString * NSStringFromGLEnum (GLenum gle)

Detailed Description


Define Documentation

#define GL_ERROR_LOGGING_ENABLED   0

LogGLErrorState logs an ERROR level description of any glError that has occurred since it was last called.

Like all logging macros, LogGLErrorState takes a format string and a variable length list of arguments. The GL error code and description is also added to the logged information.

Use the LogGLErrorState() macro and the GL_ERROR_LOGGING_ENABLED compiler switch to turn checking and logging of GL error state. Be sure to set the compiler switch GL_ERROR_LOGGING_ENABLED to zero when compiling for production code release, to avoid the overhead of making the GL error state call. This is important to maximize the GL state machine performance.

If the compiler switch GL_ERROR_ASSERTION_ENABLED is set to anything other than zero, an assertion error will also be raised to halt execution at the point where the GL error occurred, otherwise, the error will be logged and execution will continue.

#define GL_ERROR_TRACING_ENABLED   0

LogGLErrorTrace logs an ERROR level description of any glError that has occurred since it was last called.

LogGLErrorTrace is distinct from LogGLErrorState in that it is called during every GL call, whereas LogGLErrorState is invoked only once per rendering loop. This permits dual-level detection of GL errors, that can be configured as follows:

  • During development, enable GL_ERROR_LOGGING_ENABLED in all projects, but leave GL_ERROR_TRACING_ENABLED disabled. This will cause the occurance of a GL error to be checked and logged once at the end of each rendering loop.
  • If such a GL error log is encountered, temporarily enable GL_ERROR_TRACING_ENABLED in your project to turn on the checking and logging of GL errors on each GL call, thereby detecting and logging the precise GL call that triggered the GL error.
  • Once the GL error is resolved and corrected, disable GL_ERROR_TRACING_ENABLED to remove the overhead of testing for a GL error on every GL call.

The GL_ERROR_TRACING_ENABLED compiler build switch requires that the GL_ERROR_LOGGING_ENABLED compiler build switch is also set.

Like all logging macros, LogGLErrorTrace takes a format string and a variable length list of arguments. The GL error code and description is also added to the logged information.

Use the LogGLErrorTrace() macro and the GL_ERROR_TRACING_ENABLED compile switch to turn checking and logging of GL error tracing. Be sure to set the compiler switch GL_ERROR_TRACING_ENABLED to zero when compiling for production code release, to avoid the overhead of making the GL error state call. This is important to maximize the GL state machine throughput.

If the compiler switch GL_ERROR_ASSERTION_ENABLED is set to anything other than zero, an assertion error will also be raised to halt execution at the point where the GL error occurred, otherwise, the error will be logged and execution will continue.


Function Documentation

void DoLogGLErrorState ( NSString *  fmt,
  ... 
)

The implementation of the LogGLErrorState and LogGLErrorTrace compiler macros.

See the API documentation for those macros for more information on logging and tracing GL errors.

NSString* GetGLErrorText ( GLenum  errCode )

Returns a text description of the specified GL error code.

NSString* NSStringFromGLEnum ( GLenum  gle )

Returns a string containing the name of the specified GL enumeration code.