v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3OpenGL Class Reference

#import <CC3OpenGL.h>

Inheritance diagram for CC3OpenGL:
Inheritance graph
[legend]

Instance Methods

(void) - activateClientTextureUnit:
 
(void) - activateMatrixStack:
 
(void) - activatePaletteMatrixStack:
 
(void) - activateTextureUnit:
 
(void) - alignFor2DDrawingWithVisitor:
 
(void) - alignFor3DDrawingWithVisitor:
 
(void) - allocateStorageForRenderbuffer:withSize:andFormat:andSamples:
 
(void) - attachShader:toShaderProgram:
 
(void) - bindBuffer:toTarget:
 
(void) - bindFog:withVisitor:
 
(void) - bindFramebuffer:
 
(void) - bindMesh:withVisitor:
 
(void) - bindRenderbuffer:
 
(void) - bindRenderbuffer:toFrameBuffer:asAttachment:
 
(void) - bindTexture2D:face:mipmapLevel:toFrameBuffer:asAttachment:
 
(void) - bindTexture:toTarget:at:
 
(void) - bindVertexArrayObject:
 
(void) - bindVertexAttribute:withVisitor:
 
(void) - bindVertexContent:withSize:withType:withStride:withShouldNormalize:toAttributeAt:
 
(void) - captureOpenGLFrame
 
(BOOL) - checkFramebufferStatus:
 
(void) - clearBuffers:
 
(void) - clearOpenGLResourceCaches
 
(void) - clearTextureBinding:
 
(void) - clearUnboundVertexAttributes
 
(void) - compileShader:from:sourceCodeStrings:
 
(void) - compileShader:fromSourceCodeStrings:
 
(GLuint) - createShader:
 
(GLuint) - createShaderProgram
 
(NSString *) - defaultShaderPreamble
 
(void) - deleteBuffer:
 
(void) - deleteFramebuffer:
 
(void) - deleteRenderbuffer:
 
(void) - deleteShader:
 
(void) - deleteShaderProgram:
 
(void) - deleteTexture:
 
(void) - detachShader:fromShaderProgram:
 
(void) - disableTexturingAt:
 
(void) - disableTexturingFrom:
 
(void) - discard:attachments:fromFramebuffer:
 
(void) - drawIndicies:ofLength:andType:as:
 
(void) - drawVerticiesAs:startingAt:withLength:
 
(NSString *) - dumpTextureBindings
 
(void) - enable2DVertexAttributes
 
(void) - enableAlphaTesting:
 
(void) - enableBlend:
 
(void) - enableBoundVertexAttributes
 
(void) - enableClipPlane:at:
 
(void) - enableColorLogicOp:
 
(void) - enableColorMaterial:
 
(void) - enableCullFace:
 
(void) - enableDepthTest:
 
(void) - enableDither:
 
(void) - enableFog:
 
(void) - enableLight:at:
 
(void) - enableLighting:
 
(void) - enableLineSmoothing:
 
(void) - enableMatrixPalette:
 
(void) - enableMultisampling:
 
(void) - enableNormalize:
 
(void) - enablePointSmoothing:
 
(void) - enablePointSpriteCoordReplace:at:
 
(void) - enablePointSprites:
 
(void) - enablePolygonOffset:
 
(void) - enableRescaleNormal:
 
(void) - enableSampleAlphaToCoverage:
 
(void) - enableSampleAlphaToOne:
 
(void) - enableSampleCoverage:
 
(void) - enableScissorTest:
 
(void) - enableShaderPointSize:
 
(void) - enableStencilTest:
 
(void) - enableTexturing:inTarget:at:
 
(void) - enableTwoSidedLighting:
 
(void) - enableVertexAttribute:at:
 
(void) - finish
 
(void) - flush
 
(GLfloat) - fragmentShaderVarPrecision:
 
(GLfloat) - fragmentShaderVarRangeMax:
 
(GLfloat) - fragmentShaderVarRangeMin:
 
(GLuint) - generateBuffer
 
(GLuint) - generateFramebuffer
 
(void) - generateMipmapForTarget:at:
 
(GLuint) - generateRenderbuffer
 
(GLuint) - generateTexture
 
(GLfloat) - getFloat:
 
(GLint) - getInteger:
 
(GLint) - getIntegerParameter:forShader:
 
(GLint) - getIntegerParameter:forShaderProgram:
 
(NSString *) - getLogForShader:
 
(NSString *) - getLogForShaderProgram:
 
(GLint) - getRenderbufferParameterInteger:
 
(BOOL) - getShaderProgramWasLinked:
 
(BOOL) - getShaderWasCompiled:
 
(NSString *) - getSourceCodeForShader:
 
(NSString *) - getString:
 
(void) - insertEventMarker:
 
(void) - insertEventMarkerC:
 
(void) - linkShaderProgram:
 
(void) - loadBufferTarget:withData:ofLength:forUse:
 
(void) - loadModelviewMatrix:
 
(void) - loadPaletteMatrix:at:
 
(void) - loadProjectionMatrix:
 
(void) - loadTexureImage:intoTarget:onMipmapLevel:withSize:withFormat:withType:withByteAlignment:at:
 
(void) - loadTexureSubImage:intoTarget:onMipmapLevel:intoRectangle:withFormat:withType:withByteAlignment:at:
 
(GLuint) - maxTextureSizeForTarget:
 
(void) - popGroupMarker
 
(void) - popModelviewMatrixStack
 
(void) - popProjectionMatrixStack
 
(void) - populateShaderProgramVariable:
 
(void) - pushGroupMarker:
 
(void) - pushGroupMarkerC:
 
(void) - pushModelviewMatrixStack
 
(void) - pushProjectionMatrixStack
 
(void) - readPixelsIn:fromFramebuffer:into:
 
(void) - releaseShaderCompiler
 
(void) - resolveMultisampleFramebuffer:intoFramebuffer:
 
(void) - setAlphaFunc:reference:
 
(void) - setBlendFuncSrc:dst:
 
(void) - setBlendFuncSrcRGB:dstRGB:srcAlpha:dstAlpha:
 
(void) - setClearColor:
 
(void) - setClearDepth:
 
(void) - setClearStencil:
 
(void) - setColor:
 
(void) - setColorMask:
 
(void) - setCullFace:
 
(void) - setDebugLabel:forBuffer:
 
(void) - setDebugLabel:forFramebuffer:
 
(void) - setDebugLabel:forObject:ofType:
 
(void) - setDebugLabel:forRenderbuffer:
 
(void) - setDebugLabel:forShader:
 
(void) - setDebugLabel:forShaderProgram:
 
(void) - setDebugLabel:forTexture:
 
(void) - setDebugLabel:forVertexArray:
 
(void) - setDepthFunc:
 
(void) - setDepthMask:
 
(void) - setFogColor:
 
(void) - setFogDensity:
 
(void) - setFogEnd:
 
(void) - setFogHint:
 
(void) - setFogMode:
 
(void) - setFogStart:
 
(void) - setFrontFace:
 
(void) - setGenerateMipmapHint:
 
(void) - setLightAmbientColor:at:
 
(void) - setLightAttenuation:at:
 
(void) - setLightDiffuseColor:at:
 
(void) - setLightPosition:at:
 
(void) - setLightSpecularColor:at:
 
(void) - setLineSmoothingHint:
 
(void) - setLineWidth:
 
(void) - setMaterialAmbientColor:
 
(void) - setMaterialDiffuseColor:
 
(void) - setMaterialEmissionColor:
 
(void) - setMaterialShininess:
 
(void) - setMaterialSpecularColor:
 
(void) - setOpOnStencilFail:onDepthFail:onDepthPass:
 
(void) - setPerspectiveCorrectionHint:
 
(void) - setPixelPackingAlignment:
 
(void) - setPixelUnpackingAlignment:
 
(void) - setPointSize:
 
(void) - setPointSizeAttenuation:
 
(void) - setPointSizeFadeThreshold:
 
(void) - setPointSizeMaximum:
 
(void) - setPointSizeMinimum:
 
(void) - setPointSmoothingHint:
 
(void) - setPolygonOffsetFactor:units:
 
(void) - setSceneAmbientLightColor:
 
(void) - setScissor:
 
(void) - setShadeModel:
 
(void) - setShaderProgramUniformValue:
 
(void) - setSpotlightCutoffAngle:at:
 
(void) - setSpotlightDirection:at:
 
(void) - setSpotlightFadeExponent:at:
 
(void) - setStencilFunc:reference:mask:
 
(void) - setStencilMask:
 
(void) - setTextureEnvColor:at:
 
(void) - setTextureEnvMode:at:
 
(void) - setTextureHorizWrapFunc:inTarget:at:
 
(void) - setTextureMagnifyFunc:inTarget:at:
 
(void) - setTextureMinifyFunc:inTarget:at:
 
(void) - setTextureVertWrapFunc:inTarget:at:
 
(void) - setViewport:
 
(BOOL) - supportsExtension:
 
(void) - unbindBufferTarget:
 
(void) - updateBufferTarget:withData:startingAt:forLength:
 
(void) - useShaderProgram:
 
(GLfloat) - vertexShaderVarPrecision:
 
(GLfloat) - vertexShaderVarRangeMax:
 
(GLfloat) - vertexShaderVarRangeMin:
 
- Instance Methods inherited from CC3Identifiable
(void) - __deprecated
 
(id) - copy
 
(id) - copyAsClass:
 
(void) - copyUserDataFrom:
 
(id) - copyWithName:
 
(id) - copyWithName:asClass:
 
(id) - copyWithZone:withName:
 
(id) - copyWithZone:withName:asClass:
 
(BOOL) - deriveNameFrom:
 
(BOOL) - deriveNameFrom:usingSuffix:
 
(NSString *) - fullDescription
 
(id) - init
 
(id) - initAtIndex:fromPODResource:
 
(void) - initUserData
 
(id) - initWithName:
 
(id) - initWithTag:
 
(id) - initWithTag:withName:
 
(GLuint) - nextTag
 
(void) - populateFrom:
 

Class Methods

(NSObject< CC3OpenGLDelegate > *) + delegate
 
(BOOL) + isRenderThread
 
(NSThread *) + renderThread
 
(void) + setDelegate:
 
(CC3OpenGL *) + sharedGL
 
(void) + terminateOpenGL
 
- Class Methods inherited from CC3Identifiable
(GLint) + instanceCount
 
(void) + resetTagAllocation
 

Properties

GLuint maxNumberOfVertexUnits __deprecated
 
CC3GLContext * context
 
NSTimeInterval deletionDelay
 
NSSet * extensions
 
BOOL isRenderingContext
 
GLuint maxCubeMapTextureSize
 
GLuint maxNumberOfBoneInfluencesPerVertex
 
GLuint maxNumberOfClipPlanes
 
GLuint maxNumberOfFragmentShaderUniformVectors
 
GLuint maxNumberOfLights
 
GLuint maxNumberOfPaletteMatrices
 
GLuint maxNumberOfPixelSamples
 
GLuint maxNumberOfShaderProgramVaryingVectors
 
GLuint maxNumberOfTextureUnits
 
GLuint maxNumberOfVertexAttributes
 
GLuint maxNumberOfVertexShaderUniformVectors
 
GLuint maxRenderbufferSize
 
GLuint maxTextureSize
 
CC3ShaderPrewarmershaderProgramPrewarmer
 
- Properties inherited from CC3Identifiable
NSObject *sharedUserData __deprecated
 
NSString * name
 
NSString * nameSuffix
 
GLint podIndex
 
BOOL shouldIncludeInDeepCopy
 
GLuint tag
 
NSObject * userData
 
- Properties inherited from <CC3Cacheable>
NSString * name
 

Detailed Description

CC3OpenGL manages the OpenGL or OpenGL ES state for a single GL context.

CC3OpenGL is implemented as a class cluster. The abstract CC3OpenGL class supports a superset of functionality for OpenGL, OpenGL ES 1.1, or OpenGL ES 2.0. Concrete subclass implementations provide functionality tailored to each specific GL implementation.

OpenGL is designed to be a state machine that operates asynchronously from the application code that calls its functions. Calls to most gl* functions queue up commands to the GL engine that are processed by the GL engine asynchronously from the gl* call.

This design allows GL command execution to be run on a different processor than the application is running on, specifically a hardware-assisted GPU.

To maximize the throughput and performance of this design, it is important that GL state is changed only when necessary, and that querying of the GL state machine is avoided wherever possible.

By routing all GL requests through CC3OpenGL, this class can keep track of the GL state change requests made to the GL engine, and will only forward such requests to the GL engine if the state really is changing.

Method Documentation

- (void) activateClientTextureUnit: (GLuint)  tuIdx

Sets the specified texture unit as the active texture unit for client actions.

Subsequent changes made to texture unit client properties will affect only this texture unit. The specified texture unit must be a value between zero and the maximum number of texture units supported by the platform.

This method is invoked automatically for any texture action method that identifies the texture unit on which the action should be made. Normally, this method does not need to be invoked directly.

- (void) activateMatrixStack: (GLenum)  mode

Activates the specified matrix stack to make it the current matrix stack.

- (void) activatePaletteMatrixStack: (GLuint)  pmIdx

Activates the specified palette matrix stack to make it the current matrix stack.

- (void) activateTextureUnit: (GLuint)  tuIdx

Sets the specified texture unit as the active texture unit.

Subsequent changes made to texture unit properties will affect only this texture unit. The specified texture unit must be a value between zero and the maximum number of texture units supported by the platform.

This method is invoked automatically for any texture action method that identifies the texture unit on which the action should be made. Normally, this method does not need to be invoked directly.

- (void) alignFor2DDrawingWithVisitor: (CC3NodeDrawingVisitor *)  visitor

Aligns the state within the GL engine to be suitable for 2D drawing by Cocos2D.

This is invoked automatically during the transition from 3D to 2D drawing. You can also invoke this method if you perform 3D activities outside of the normal drawing loop, and you find that it interferes with subsequent 2D rendering by Cocos2D. However, such occurrances should be rare, and in most circumstances you should never need to invoke this method.

- (void) alignFor3DDrawingWithVisitor: (CC3NodeDrawingVisitor *)  visitor

Aligns the state within the GL engine to be suitable for 3D drawing by Cocos3D.

This is invoked automatically during the transition from 2D to 3D drawing.

- (void) allocateStorageForRenderbuffer: (GLuint)  rbID
withSize: (CC3IntSize size
andFormat: (GLenum)  format
andSamples: (GLuint)  pixelSamples 

Allocates storage for the specified renderbuffer, sufficient to render an image of the specified size, in the specified pixel format, and with the specified number of samples per pixel, which will be a value larger than one if antialiasing multisampling is in use.

If multi-sampling is not supported by the platform, the pixelSamples value is ignored.

- (void) attachShader: (GLuint)  shaderID
toShaderProgram: (GLuint)  programID 

Attaches the specified shader to the specified shader program.

- (void) bindBuffer: (GLuint)  buffId
toTarget: (GLenum)  target 

Binds the buffer with the specified ID to the specified buffer target.

- (void) bindFog: (CC3Fog *)  fog
withVisitor: (CC3NodeDrawingVisitor *)  visitor 

Binds the specified fog configuration to the GL engine.

- (void) bindFramebuffer: (GLuint)  fbID

Makes the framebuffer with the specified ID the current framebuffer in the GL engine.

- (void) bindMesh: (CC3Mesh *)  mesh
withVisitor: (CC3NodeDrawingVisitor *)  visitor 

Binds the vertex attributes in the specified mesh to the GL engine.

- (void) bindRenderbuffer: (GLuint)  rbID

Makes the renderbuffer with the specified ID the current renderbuffer in the GL engine.

- (void) bindRenderbuffer: (GLuint)  rbID
toFrameBuffer: (GLuint)  fbID
asAttachment: (GLenum)  attachment 

Binds the specified renderbuffer to the specified framebuffer as the specified attachement.

- (void) bindTexture2D: (GLuint)  texID
face: (GLenum)  face
mipmapLevel: (GLint)  mipmapLevel
toFrameBuffer: (GLuint)  fbID
asAttachment: (GLenum)  attachment 

Binds the specified mipmap level of the specified face of the specified texture to the specified framebuffer as the specified attachement.

- (void) bindTexture: (GLuint)  texID
toTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Binds the texture with the specified ID to the specified target at the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) bindVertexArrayObject: (GLuint)  vaoId

Binds the VAO with the specified ID.

- (void) bindVertexAttribute: (CC3GLSLAttribute *)  attribute
withVisitor: (CC3NodeDrawingVisitor *)  visitor 

Retrieves the vertex array that should be bound to the specified attribute from the mesh of the current node and binds the content of the vertex array to the GLSL attribute.

Does nothing if the mesh does not contain vertex content for the specified attribute.

- (void) bindVertexContent: (GLvoid *)  pData
withSize: (GLint)  elemSize
withType: (GLenum)  elemType
withStride: (GLsizei)  vtxStride
withShouldNormalize: (BOOL)  shldNorm
toAttributeAt: (GLint)  vaIdx 

Binds the content pointer, size, type, stride, and normalization requirements value together for the vertex attribute at the specified index, which should be below the maximum number of vertex attributes supported by the platform.

The values will be set in the GL engine only if at least one of the values has actually changed.

It is safe to submit a negative index. It will be ignored, and no changes will be made.

- (void) captureOpenGLFrame

Capture the current OpenGL command stream frame, starting at this point.

- (BOOL) checkFramebufferStatus: (GLuint)  fbID

Checks the completeness status of the specified framebuffer, and returns YES if the framebuffer is complete and ready to be drawn to, or NO if the framebuffer is not ready to be drawn to.

If the framebuffer is not complete, an error is logged, and, if the GL_ERROR_ASSERTION_ENABLED compiler build setting is set, an assertion error is raised.

- (void) clearBuffers: (GLbitfield)  mask

Clears the buffers identified by the specified bitmask, which is a bitwise OR combination of one or more of the following masks: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT.

- (void) clearOpenGLResourceCaches

Clears content and resource caches that use OpenGL, including the CC3ShaderPrewarmer instance in the shaderProgramPrewarmer property, and the following OpenGL resource caches:

   - CC3Resource
- (void) clearTextureBinding: (GLuint)  texID

Clears the tracking of the specified texture.

For each texture unit whose state tracking indicates that it is bound to the specified texture, sets the tracking state for that texture unit to the default texture ID (0), to ensure that the state tracking no longer expects to be bound to that texture.

This method is invoked automatically whenever a GL texture is deleted, or whenever a GL texture is removed from Cocos3D, but may still be in use by Cocos2D.

- (void) clearUnboundVertexAttributes

Clears the tracking of unbound vertex attribute arrays.

- (void) compileShader: (GLuint)  shaderID
from: (GLuint)  srcStrCount
sourceCodeStrings: (const GLchar **)  srcCodeStrings 

Compiles the specified shader from the specified number of GLSL source code strings, which is an array of null-terminated UTF8 strings.

The number of source strings in the source string array must be at least as large as the specified count.

You can use the getShaderWasCompiled: method to determine whether compilation was successful, and the getLogForShader: method to retrieve the reason for any unsuccessful compilation.

- (void) compileShader: (GLuint)  shaderID
fromSourceCodeStrings: (NSArray *)  __deprecated 
Deprecated:
Use the compileShader:from:sourceCodeStrings: method instead.
- (GLuint) createShader: (GLenum)  shaderType

Creates a new shader of the specifed type and returns its ID.

The shaderType parameter must be one of the following values:

  • GL_VERTEX_SHADER
  • GL_FRAGMENT_SHADER
- (GLuint) createShaderProgram

Creates a new GLSL program and returns its ID.

- (NSString*) defaultShaderPreamble

Returns a string containing platform-specific GLSL source code to be used as a preamble for the vertex and fragment shader source code when compiling the shaders.

+ (NSObject<CC3OpenGLDelegate>*) delegate

Returns the CC3OpenGLDelegate delegate that will receive callback notifications for asynchronous OpenGL activities.

- (void) deleteBuffer: (GLuint)  buffID

Deletes the GL buffer with the specifid buffer ID.

This is a wrapper for the GL function glDeleteBuffers.

- (void) deleteFramebuffer: (GLuint)  fbID

Deletes the framebuffer with the specified ID from the GL engine.

- (void) deleteRenderbuffer: (GLuint)  rbID

Deletes the renderbuffer with the specified ID from the GL engine.

- (void) deleteShader: (GLuint)  shaderID

Deletes the shader with the specified ID from the GL engine.

- (void) deleteShaderProgram: (GLuint)  programID

Deletes the shader program with the specified ID from the GL engine.

- (void) deleteTexture: (GLuint)  texID

Deletes the texture with the specified ID from the GL engine.

- (void) detachShader: (GLuint)  shaderID
fromShaderProgram: (GLuint)  programID 

Detaches the specified shader from the specified shader program.

- (void) disableTexturingAt: (GLuint)  tuIdx

Disables texturing for all targets in the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) disableTexturingFrom: (GLuint)  tuIdx

Disables texturing for all targets in all texture units starting at, and above, the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) discard: (GLsizei)  count
attachments: (const GLenum *)  attachments
fromFramebuffer: (GLuint)  fbID 

Discards the specified attachments from the specified framebuffer.

The attachments parameter is an array of framebuffer attachments enums that is may include:

  • GL_COLOR_ATTACHMENT0
  • GL_DEPTH_ATTACHMENT
  • GL_STENCIL_ATTACHMENT

The count parameter indicates the length of this array.

- (void) drawIndicies: (GLvoid *)  indicies
ofLength: (GLuint)  len
andType: (GLenum)  type
as: (GLenum)  drawMode 

Draws the vertices indexed by the specified indices, to the specified number of indices, each of the specified GL type, and using the specified draw mode.

This is a wrapper for the GL function glDrawElements.

- (void) drawVerticiesAs: (GLenum)  drawMode
startingAt: (GLuint)  start
withLength: (GLuint)  len 

Draws vertices bound by the vertex pointers using the specified draw mode, starting at the specified index, and drawing the specified number of verticies.

This is a wrapper for the GL function glDrawArrays.

- (NSString*) dumpTextureBindings

Returns a string description of the current texture object bindings for each texture unit.

- (void) enable2DVertexAttributes

Enables the vertex attribute needed for drawing Cocos2D 2D artifacts, and disables all the rest.

- (void) enableAlphaTesting: (BOOL)  onOff

Enable/disable alpha testing.

- (void) enableBlend: (BOOL)  onOff

Enable/disable blending.

- (void) enableBoundVertexAttributes

Enables the vertex attributes that have been bound and disables the rest.

- (void) enableClipPlane: (BOOL)  onOff
at: (GLuint)  clipIdx 

Enable/disable the user clipping plane at the specified index, which must be a value between zero and the maximum number of clipping planes supported by the platform.

- (void) enableColorLogicOp: (BOOL)  onOff

Enable/disable the current color logic operation.

- (void) enableColorMaterial: (BOOL)  onOff

Enable/disable the ambient & diffuse material colors to track vertex color.

- (void) enableCullFace: (BOOL)  onOff

Enable/disable polygon face culling.

- (void) enableDepthTest: (BOOL)  onOff

Enable/disable depth testing.

- (void) enableDither: (BOOL)  onOff

Enable/disable dithering.

- (void) enableFog: (BOOL)  onOff

Enable/disable fogging.

- (void) enableLight: (BOOL)  onOff
at: (GLuint)  ltIdx 

Enable/disable the light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) enableLighting: (BOOL)  onOff

Enable/disable lighting.

- (void) enableLineSmoothing: (BOOL)  onOff

Enable/disable line smoothing.

- (void) enableMatrixPalette: (BOOL)  onOff

Enable/disable bone skinning using matrix palettes.

- (void) enableMultisampling: (BOOL)  onOff

Enable/disable sampling multiple fragments per pixel.

- (void) enableNormalize: (BOOL)  onOff

Enable/disable the re-normalizing of normals when they are transformed.

- (void) enablePointSmoothing: (BOOL)  onOff

Enable/disable point smoothing.

- (void) enablePointSpriteCoordReplace: (BOOL)  onOff
at: (GLuint)  tuIdx 

Enable/disable point sprite texture coordinate replacement for the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) enablePointSprites: (BOOL)  onOff

Enable/disable displaying points as textured point sprites.

- (void) enablePolygonOffset: (BOOL)  onOff

Enable/disable offsetting fragment depth when comparing depths.

- (void) enableRescaleNormal: (BOOL)  onOff

Enable/disable the re-scaling of normals when they are transformed.

- (void) enableSampleAlphaToCoverage: (BOOL)  onOff

Enable/disable alpha coverage in multisampling.

- (void) enableSampleAlphaToOne: (BOOL)  onOff

Enable/disable setting alpha to one when multisampling.

- (void) enableSampleCoverage: (BOOL)  onOff

Enable/disable sample coverage.

- (void) enableScissorTest: (BOOL)  onOff

Enable/disable discarding pixels that are outside to a scissor rectangle.

- (void) enableShaderPointSize: (BOOL)  onOff

Enable/disable displaying points as textured point sprites.

- (void) enableStencilTest: (BOOL)  onOff

Enable/disable discarding pixels that are not part of a defined stencil.

- (void) enableTexturing: (BOOL)  onOff
inTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Enable/disable texturing for the specified target in the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) enableTwoSidedLighting: (BOOL)  onOff

Enable/disable two-sided lighting.

- (void) enableVertexAttribute: (BOOL)  onOff
at: (GLint)  vaIdx 

Enable/disable the vertex attributes at the specified index, which must be a value between zero and the maximum number of vertex attributes supported by the platform.

It is safe to submit a negative index. It will be ignored, and no changes will be made.

- (void) finish

Flushes the GL buffer to the GL hardware, and returns only when all GL commands have finished.

- (void) flush

Flushes the GL buffer to the GL hardware.

- (GLfloat) fragmentShaderVarPrecision: (GLenum)  precisionType

Returns the resolvable precision of the shader variable of the specified type within a fragment shader, or returns zero if the platform does not support shader precision modifiers.

The precisionType argument must be one of:

  • GL_LOW_FLOAT
  • GL_MEDIUM_FLOAT
  • GL_HIGH_FLOAT
  • GL_LOW_INT
  • GL_MEDIUM_INT
  • GL_HIGH_INT
- (GLfloat) fragmentShaderVarRangeMax: (GLenum)  precisionType

Returns the maximum precision value of the shader variable of the specified type for a fragment shader, or returns zero if the platform does not support shader precision modifiers.

For float variable types, this value is the (+/-) maximum value. For int variable types, this is the absolute maximum positive value.

The precisionType argument must be one of:

  • GL_LOW_FLOAT
  • GL_MEDIUM_FLOAT
  • GL_HIGH_FLOAT
  • GL_LOW_INT
  • GL_MEDIUM_INT
  • GL_HIGH_INT
- (GLfloat) fragmentShaderVarRangeMin: (GLenum)  precisionType

Returns the minimum precision value of the shader variable of the specified type for a fragment shader, or returns zero if the platform does not support shader precision modifiers.

For float variable types, this value is the (+/-) minimum resolvable value. For int variable types, this is the absolute minimum negative value.

The precisionType argument must be one of:

  • GL_LOW_FLOAT
  • GL_MEDIUM_FLOAT
  • GL_HIGH_FLOAT
  • GL_LOW_INT
  • GL_MEDIUM_INT
  • GL_HIGH_INT
- (GLuint) generateBuffer

Generates and returns a GL buffer ID.

This is a wrapper for the GL function glGenBuffers.

- (GLuint) generateFramebuffer

Generates and returns a new framebuffer ID.

- (void) generateMipmapForTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Generates a mipmap for the specified target for the texture bound to the specified texture unit.

- (GLuint) generateRenderbuffer

Generates and returns a new renderbuffer ID.

- (GLuint) generateTexture

Generates a new texture and returns its ID.

- (GLfloat) getFloat: (GLenum)  param

Returns the current value in the GL engine of the specified float parameter.

- (GLint) getInteger: (GLenum)  param

Returns the current value in the GL engine of the specified integer parameter.

- (GLint) getIntegerParameter: (GLenum)  param
forShader: (GLuint)  shaderID 

Returns the integer value of the specified GL engine parameter for the specified shader.

- (GLint) getIntegerParameter: (GLenum)  param
forShaderProgram: (GLuint)  programID 

Returns the integer value of the specified GL engine parameter for the specified shader program.

- (NSString*) getLogForShader: (GLuint)  shaderID

Returns the GL status info log for the specified shader.

- (NSString*) getLogForShaderProgram: (GLuint)  programID

Returns the GL status info log for the GL program.

- (GLint) getRenderbufferParameterInteger: (GLenum)  param

Returns the current value in the GL engine of the specified integer renderbuffer parameter.

- (BOOL) getShaderProgramWasLinked: (GLuint)  programID

Returns whether the specified shader was successfully linked.

- (BOOL) getShaderWasCompiled: (GLuint)  shaderID

Returns whether the specified shader was successfully compiled.

- (NSString*) getSourceCodeForShader: (GLuint)  shaderID

Returns the GLSL source code for the specified shader.

- (NSString*) getString: (GLenum)  param

Returns the current value in the GL engine of the specified string parameter.

- (void) insertEventMarker: (NSString *)  marker

Inserts the specified marker into the GL command stream.

This marker can be used by the debugger to organize the presentation of the commands in an OpenGL frame.

This version must convert the specified marker string into a 'C' string in order to send it to the GL engine. For better performance, use the pushGroupMarkerC: version of this method, and consider using a static 'C' string, or caching the 'C' string to avoid creating it on each frame.

- (void) insertEventMarkerC: (const char *)  marker

Inserts the specified marker into the GL command stream.

This marker can be used by the debugger to organize the presentation of the commands in an OpenGL frame.

For best performance, consider using a static string, or caching the string to avoid creating it on each frame.

+ (BOOL) isRenderThread

Returns whether the current thread is being used for primary rendering.

- (void) linkShaderProgram: (GLuint)  programID

Links the specified shader program.

You can use the getShaderProgramWasLinked: method to determine whether linking was successful, and the getLogForShaderProgram: method to retrieve the reason for any unsuccessful link attempt.

- (void) loadBufferTarget: (GLenum)  target
withData: (GLvoid *)  buffPtr
ofLength: (GLsizeiptr)  buffLen
forUse: (GLenum)  buffUsage 

Loads data into the GL buffer currently bound to the specified target, starting at the specified buffer pointer, and extending for the specified length.

The buffer usage is a hint for the GL engine, and must be a valid GL buffer usage enumeration value.

- (void) loadModelviewMatrix: (const CC3Matrix4x3 *)  mtx

Activates the modelview matrix stack and replaces the current matrix with the specified matrix.

- (void) loadPaletteMatrix: (const CC3Matrix4x3 *)  mtx
at: (GLuint)  pmIdx 

Activates the specified palette matrix stack and replaces the current matrix with the specified matrix.

- (void) loadProjectionMatrix: (const CC3Matrix4x4 *)  mtx

Activates the projection matrix stack and replaces the current matrix with the specified matrix.

- (void) loadTexureImage: (const GLvoid *)  imageData
intoTarget: (GLenum)  target
onMipmapLevel: (GLint)  mipmapLevel
withSize: (CC3IntSize size
withFormat: (GLenum)  texelFormat
withType: (GLenum)  texelType
withByteAlignment: (GLint)  byteAlignment
at: (GLuint)  tuIdx 

Loads the specified texture image data, with the specified characteristics, into the specified target at the specified texture unit, in GL memory.

- (void) loadTexureSubImage: (const GLvoid *)  imageData
intoTarget: (GLenum)  target
onMipmapLevel: (GLint)  mipmapLevel
intoRectangle: (CC3Viewport rect
withFormat: (GLenum)  texelFormat
withType: (GLenum)  texelType
withByteAlignment: (GLint)  byteAlignment
at: (GLuint)  tuIdx 

Loads the specified texture image data, with the specified characteristics, into the specified rectangular area within the texture at the specified target and texture unit, in GL memory.

The image data replaces the texture data within the specified bounds.

- (GLuint) maxTextureSizeForTarget: (GLenum)  target

Returns the maximum size for a texture used for the specified target supported by the platform.

- (void) popGroupMarker

Pops the current group marker from the GL command stream.

This is the complement to the pushGroupMarker: or pushGroupMarkerC: methods, and you can use this method in conjunction with either of those methods.

- (void) popModelviewMatrixStack

Activates the modelview matrix stack and pops off the current top level.

- (void) popProjectionMatrixStack

Activates the projection matrix stack and pops off the current top level.

- (void) populateShaderProgramVariable: (CC3GLSLVariable *)  var

Populates the specified GLSL variable with info retrieved from the GL engine.

- (void) pushGroupMarker: (NSString *)  marker

Pushes the specified group marker into the GL command stream.

This marker can be used by the debugger to organize the presentation of the commands in an OpenGL frame.

This version must convert the specified marker string into a 'C' string in order to send it to the GL engine. For better performance, use the pushGroupMarkerC: version of this method, and consider using a static 'C' string, or caching the 'C' string to avoid creating it on each frame.

- (void) pushGroupMarkerC: (const char *)  marker

Pushes the specified group marker into the GL command stream.

This marker can be used by the debugger to organize the presentation of the commands in an OpenGL frame.

For best performance, consider using a static string, or caching the string to avoid creating it on each frame.

- (void) pushModelviewMatrixStack

Activates the modelview matrix stack, pushes it down one level, and copies the old top to the new top.

- (void) pushProjectionMatrixStack

Activates the projection matrix stack, pushes it down one level, and copies the old top to the new top.

- (void) readPixelsIn: (CC3Viewport rect
fromFramebuffer: (GLuint)  fbID
into: (ccColor4B *)  colorArray 

Reads the color content of the range of pixels defined by the specified rectangle from the GL color buffer of the currently bound framebuffer, into the specified array, which must be large enough to accommodate the number of pixels covered by the specified rectangle.

Content is written to memory left to right across each row, starting at the row at the bottom of the image, and ending at the row at the top of the image. The pixel content is packed tightly into the specified array, with no gaps left at the end of each row. In memory, the last pixel of one row is immediately followed by the first pixel of the next row.

If the specified framebuffer is not the active framebuffer, it is temporarily activated, long enough to read the contents, then the current framebuffer is reactivated. This allows pixels to be read from a secondary framebuffer while rendering to the active framebuffer.

This method should be used with care, since it involves making a synchronous call to query the state of the GL engine. This method will not return until the GL engine has executed all previous drawing commands in the pipeline. Excessive use of this method will reduce GL throughput and performance.

- (void) releaseShaderCompiler

Releases the shader compiler and its resources from the GL engine.

It will be restored automatically on the next shader compilation request.

+ (NSThread*) renderThread

Returns the thread that is being used for primary rendering.

- (void) resolveMultisampleFramebuffer: (GLuint)  fbSrcID
intoFramebuffer: (GLuint)  fbDstID 

Resolves the content in the specified multisample framebuffer into the specified framebuffer, and leaves the multisample framebuffer bound to the GL_FRAMEBUFFER target for further rendering.

- (void) setAlphaFunc: (GLenum)  func
reference: (GLfloat)  ref 

Sets the alpha function and reference value.

- (void) setBlendFuncSrc: (GLenum)  src
dst: (GLenum)  dst 

Sets the blend function, forcing RGB and alpha blending to use the same blending function.

- (void) setBlendFuncSrcRGB: (GLenum)  srcRGB
dstRGB: (GLenum)  dstRGB
srcAlpha: (GLenum)  srcAlpha
dstAlpha: (GLenum)  dstAlpha 

Sets the blend function, allowing RGB and alpha blending to be set separately.

- (void) setClearColor: (ccColor4F)  color

Sets the color used to clear the color buffer.

- (void) setClearDepth: (GLfloat)  val

Sets the value used to clear the depth buffer.

- (void) setClearStencil: (GLint)  val

Sets the value used to clear the stencil buffer.

- (void) setColor: (ccColor4F)  color

Sets the color used to paint in the absence of materials and textures.

- (void) setColorMask: (ccColor4B)  mask

Sets the color mask indicating which of R, G, B & A should be written to the color buffer.

- (void) setCullFace: (GLenum)  val

Sets the faces to cull.

- (void) setDebugLabel: (NSString *)  label
forBuffer: (GLuint)  buffID 

Sets the debug label for the specified buffer.

- (void) setDebugLabel: (NSString *)  label
forFramebuffer: (GLuint)  fbID 

Sets the debug label for the specified framebuffer.

- (void) setDebugLabel: (NSString *)  label
forObject: (GLuint)  objID
ofType: (GLenum)  objType 

Sets the debug label for the specified GL object of the specified type.

- (void) setDebugLabel: (NSString *)  label
forRenderbuffer: (GLuint)  rbID 

Sets the debug label for the specified renderbuffer.

- (void) setDebugLabel: (NSString *)  label
forShader: (GLuint)  shaderID 

Sets the debug label for the specified shader.

- (void) setDebugLabel: (NSString *)  label
forShaderProgram: (GLuint)  progID 

Sets the debug label for the specified shader program.

- (void) setDebugLabel: (NSString *)  label
forTexture: (GLuint)  texID 

Sets the debug label for the specified texture.

- (void) setDebugLabel: (NSString *)  label
forVertexArray: (GLuint)  vaID 

Sets the debug label for the specified vertex array.

+ (void) setDelegate: (NSObject< CC3OpenGLDelegate > *)  delegate

Sets the CC3OpenGLDelegate delegate that will receive callback notifications for asynchronous OpenGL activities.

- (void) setDepthFunc: (GLenum)  val

Sets the depth function to use when comparing depths.

- (void) setDepthMask: (BOOL)  writable

Sets whether the depth buffer is enabled for writing.

- (void) setFogColor: (ccColor4F)  color

Sets the color of the fog.

- (void) setFogDensity: (GLfloat)  val

Sets the density of the fog.

- (void) setFogEnd: (GLfloat)  val

Sets the end distance of the fog.

- (void) setFogHint: (GLenum)  hint

Sets the fog hint.

- (void) setFogMode: (GLenum)  mode

Sets the type of the fog.

- (void) setFogStart: (GLfloat)  val

Sets the start distance of the fog.

- (void) setFrontFace: (GLenum)  val

Sets which face winding is considered to be the front face.

- (void) setGenerateMipmapHint: (GLenum)  hint

Sets the mipmap generation hint.

- (void) setLightAmbientColor: (ccColor4F)  color
at: (GLuint)  ltIdx 

Sets the ambient color of the light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setLightAttenuation: (CC3AttenuationCoefficients ac
at: (GLuint)  ltIdx 

Sets the distance attenuation coefficients of the light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setLightDiffuseColor: (ccColor4F)  color
at: (GLuint)  ltIdx 

Sets the diffuse color of the light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setLightPosition: (CC3Vector4 pos
at: (GLuint)  ltIdx 

Sets the homogeneous position of the light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setLightSpecularColor: (ccColor4F)  color
at: (GLuint)  ltIdx 

Sets the specular color of the light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setLineSmoothingHint: (GLenum)  hint

Sets the line smooting hint.

- (void) setLineWidth: (GLfloat)  val

Sets the width used to draw lines.

- (void) setMaterialAmbientColor: (ccColor4F)  color

Sets the ambient color of the material.

- (void) setMaterialDiffuseColor: (ccColor4F)  color

Sets the diffuse color of the material.

- (void) setMaterialEmissionColor: (ccColor4F)  color

Sets the emission color of the material.

- (void) setMaterialShininess: (GLfloat)  val

Sets the shininess of the material.

- (void) setMaterialSpecularColor: (ccColor4F)  color

Sets the specular color of the material.

- (void) setOpOnStencilFail: (GLenum)  sFail
onDepthFail: (GLenum)  dFail
onDepthPass: (GLenum)  dPass 

Sets the operations when the stencil fails, the depth test fails, or the depth test passes.

- (void) setPerspectiveCorrectionHint: (GLenum)  hint

Sets the perspective correction hint.

- (void) setPixelPackingAlignment: (GLint)  byteAlignment

Sets the packing alignment when writing pixel content from the GL engine into application memory to the specified alignment, which may be 1, 2, 4 or 8.

This value indicates whether each row of pixels should start at a 1, 2, 4 or 8 byte boundary. Depending on the width of the image, a value other than 1 may result in additional bytes being added at the end of each row of pixels, in order to maintain the specified byte alignment. The contents of those additional bytes is undefined.

- (void) setPixelUnpackingAlignment: (GLint)  byteAlignment

Sets the unpacking alignment when reading pixel content from application memory for copying into the GL engine to the specified alignment, which may be 1, 2, 4 or 8.

This value indicates whether each row of pixels should start at a 1, 2, 4 or 8 byte boundary. Depending on the width of the image, a value other than 1 may require that the application add additional bytes to the end of each row of pixels, in order to maintain the specified byte alignment. The contents of those additional bytes is not copied into the GL engine.

- (void) setPointSize: (GLfloat)  val

Sets the size used to draw points.

- (void) setPointSizeAttenuation: (CC3AttenuationCoefficients ac

Sets the point size attenuation coefficients.

- (void) setPointSizeFadeThreshold: (GLfloat)  val

Sets the point size below which points will be faded away.

- (void) setPointSizeMaximum: (GLfloat)  val

Sets the maximum size at which points will be drawn.

- (void) setPointSizeMinimum: (GLfloat)  val

Sets the minimum size at which points will be drawn.

- (void) setPointSmoothingHint: (GLenum)  hint

Sets the point smooting hint.

- (void) setPolygonOffsetFactor: (GLfloat)  factor
units: (GLfloat)  units 

Sets the polygon offset factor and units.

- (void) setSceneAmbientLightColor: (ccColor4F)  color

Sets the color of the ambient scene lighting.

- (void) setScissor: (CC3Viewport vp

Sets the scissor clipping rectangle.

- (void) setShadeModel: (GLenum)  val

Sets the shading model.

- (void) setShaderProgramUniformValue: (CC3GLSLUniform *)  uniform

Ensures that the shader program for the specified GLSL uniform is active, then sets the value of the uniform into the GL engine.

- (void) setSpotlightCutoffAngle: (GLfloat)  val
at: (GLuint)  ltIdx 

Sets the cutoff angle of the spot light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setSpotlightDirection: (CC3Vector dir
at: (GLuint)  ltIdx 

Sets the direction of the spot light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setSpotlightFadeExponent: (GLfloat)  val
at: (GLuint)  ltIdx 

Sets the angular fading exponent of the spot light at the specified index, which must be a value between zero and the maximum number of lights supported by the platform.

- (void) setStencilFunc: (GLenum)  func
reference: (GLint)  ref
mask: (GLuint)  mask 

Sets the stencil function parameters.

- (void) setStencilMask: (GLuint)  mask

Sets mask for enabling writing of individual bits in the stencil buffer.

- (void) setTextureEnvColor: (ccColor4F)  color
at: (GLuint)  tuIdx 

Sets the texture environment color of the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) setTextureEnvMode: (GLenum)  mode
at: (GLuint)  tuIdx 

Sets the texture environment mode of the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) setTextureHorizWrapFunc: (GLenum)  func
inTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Sets the texture horizontal wrapping function in the specified target of the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) setTextureMagnifyFunc: (GLenum)  func
inTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Sets the texture magnifying function in the specified target of the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) setTextureMinifyFunc: (GLenum)  func
inTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Sets the texture minifying function in the specified target of the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) setTextureVertWrapFunc: (GLenum)  func
inTarget: (GLenum)  target
at: (GLuint)  tuIdx 

Sets the texture vertical wrapping function in the specified target of the specified texture unit index, which must be a value between zero and the maximum number of texture units supported by the platform.

- (void) setViewport: (CC3Viewport vp

Sets the viewport rectangle.

+ (CC3OpenGL*) sharedGL

Returns the shared singleton instance for the currently running thread, creating it if necessary.

Within OpenGL, the state of the GL engine is tracked per thread. To support this, although the interface is as a singleton, this implementation actually keeps track of a CC3OpenGL instance per thread, and will return the appropriate instance according to which thread the invocation of this method is occuring.

Currently, a maximum of two instances are supported, one for the primary rendering thread, and one for a single background thread that can be used for loading resources, textures, and shaders.

- (BOOL) supportsExtension: (NSString *)  extensionName

Returns whether this platform supports the GL extension with the specified name, which should be the name of the GL extension, as registered with the OpenGL standards bodies, or as specified by the GPU driver manufacturer.

You may specify the name either with or without a "GL_" prefix (eg. both "OES_packed_depth_stencil" and @"GL_OES_packed_depth_stencil" will work if that extension is supported).

This method checks the extensions collection for the presence of the specified name. Although this is an optimized hash test, you should generally not use this test in time-critical code. If you need to frequently test for the presence of an extension (for example, within the render loop), you should invoke this method once at the beginning of your app, and cache the resulting boolean value elsewhere in your code.

+ (void) terminateOpenGL

Terminates the current use of OpenGL by this application.

Terminates the CCDirector.sharedDirector singleton. Terminates OpenGL and deletes all GL contexts, serving all threads. Also clears all caches that contain content that uses OpenGL, including:

CC3Texture

You can invoke this method when your app no longer needs support for OpenGL, or will not use OpenGL for a significant amount of time, in order to free up app and OpenGL memory used by your application.

To ensure that further OpenGL calls are not attempted, before invoking this method, you should release all CC3Scenes that you have created or loaded, along with any Cocos2D components.

To ensure that that the current GL activity has finished before pulling the rug out from under it, this request is queued for each existing context, on the thread for which the context was created, and will only be executed once any currently running tasks on the queue have been completed.

In addition, once dequeued, a short delay is imposed, before the context instance is actually released and deallocated, to provide time for object deallocation and cleanup after the caches have been cleared, and autorelease pools have been drained. The length of this delay may be different for each context instance, and is specified by the deletionDelay property of each instance.

Since much of the processing of this method is handled through queued operations, as described above, this method will return as soon as the requests are queued, and well before the operations have completed, and OpenGL has been terminated.

You can choose to be notified once all operations triggered by this method have completed, and OpenGL has been terminated, by registering a delegate object using the setDelegate: class method. The delegate object will be sent the didTerminateOpenGL method once all operations triggered by this method have completed, and OpenGL has been terminated. You should use this delegate notification if you intend to make use of OpenGL again, as you must wait for one OpenGL session to terminate before starting another.

Note that, in order to ensure that OpenGL is free to shutdown, this method forces the CC3Texture shouldCacheAssociatedCCTextures class-side property to NO, so that any background loading that is currently occurring will not cache Cocos2D textures. If you had set this property to YES, and intend to restart OpenGL at some point, then you might want to set it back to YES before reloading 3D resources again.

Use this method with caution, as creating the GL contexts again will require significant overhead.

- (void) unbindBufferTarget: (GLenum)  target

Unbinds all buffers from the specified buffer target.

This is equivalent to invoking the bindBuffer:toTarget: method with a zero buffID parameter.

- (void) updateBufferTarget: (GLenum)  target
withData: (GLvoid *)  buffPtr
startingAt: (GLintptr)  offset
forLength: (GLsizeiptr)  length 

Updates data in the GL buffer currently bound to the specified target, from data starting at the specified offset to the specified pointer, and extending for the specified length.

- (void) useShaderProgram: (GLuint)  programID

Binds the specified GLSL program as the program to be used for subsequent rendering.

- (GLfloat) vertexShaderVarPrecision: (GLenum)  precisionType

Returns the resolvable precision of the shader variable of the specified type within a vertex shader, or returns zero if the platform does not support shader precision modifiers.

The precisionType argument must be one of:

  • GL_LOW_FLOAT
  • GL_MEDIUM_FLOAT
  • GL_HIGH_FLOAT
  • GL_LOW_INT
  • GL_MEDIUM_INT
  • GL_HIGH_INT
- (GLfloat) vertexShaderVarRangeMax: (GLenum)  precisionType

Returns the maximum precision value of the shader variable of the specified type for a vertex shader, or returns zero if the platform does not support shader precision modifiers.

For float variable types, this value is the (+/-) maximum value. For int variable types, this is the absolute maximum positive value.

The precisionType argument must be one of:

  • GL_LOW_FLOAT
  • GL_MEDIUM_FLOAT
  • GL_HIGH_FLOAT
  • GL_LOW_INT
  • GL_MEDIUM_INT
  • GL_HIGH_INT
- (GLfloat) vertexShaderVarRangeMin: (GLenum)  precisionType

Returns the minimum precision value of the shader variable of the specified type for a vertex shader, or returns zero if the platform does not support shader precision modifiers.

For float variable types, this value is the (+/-) minimum resolvable value. For int variable types, this is the absolute minimum negative value.

The precisionType argument must be one of:

  • GL_LOW_FLOAT
  • GL_MEDIUM_FLOAT
  • GL_HIGH_FLOAT
  • GL_LOW_INT
  • GL_MEDIUM_INT
  • GL_HIGH_INT

Property Documentation

- (GLuint maxNumberOfVertexUnits) __deprecated
readnonatomicassign
Deprecated:
Renamed to maxNumberOfBoneInfluencesPerVertex.
- (CC3GLContext*) context
readwritenonatomicretain

The OpenGL engine context.

The value of this property is automatically retrieved from the CCGLView.

- (NSTimeInterval) deletionDelay
readwritenonatomicassign

Indicates the length of time, in seconds, that this instance will wait after the terminateOpenGL method is invoked, before this instance is actually deleted.

This delay is intended to provide time for object deallocation and cleanup after the caches have been cleared, and autorelease pools have been drained.

The value of this property is specified in seconds. The initial value of this is 0 for the instance that is used on the primary rendering thread, and 0.25 for the instance that is used for loading resources in the background.

- (NSSet*) extensions
readnonatomicretain

Returns a collection of names of the GL extensions supported by the platform.

- (BOOL) isRenderingContext
readnonatomicassign

Returns whether this instance is tracking state for the primary rendering GL context on the rendering thread.

- (GLuint) maxCubeMapTextureSize
readnonatomicassign

Returns the maximum size for a cube-map texture supported by the platform.

- (GLuint) maxNumberOfBoneInfluencesPerVertex
readnonatomicassign

Returns the maximum number of vertex skinning bone influences per vertex supported by the platform, or zero if the platform does not impose a limit.

- (GLuint) maxNumberOfClipPlanes
readnonatomicassign

Returns the maximum number of clip planes supported by the platform.

- (GLuint) maxNumberOfFragmentShaderUniformVectors
readnonatomicassign

Returns the maximum number of GLSL uniform vectors allowed in each fragment shader.

- (GLuint) maxNumberOfLights
readnonatomicassign

Returns the maximum number of lights supported by the platform.

- (GLuint) maxNumberOfPaletteMatrices
readnonatomicassign

Returns the maximum number of vertex skinning palette matrices supported by the platform, or zero if the platform does not impose a limit.

- (GLuint) maxNumberOfPixelSamples
readnonatomicassign

Returns the maximum number of pixel samples supported by the platform, or zero if the platform does not impose a limit.

- (GLuint) maxNumberOfShaderProgramVaryingVectors
readnonatomicassign

Returns the maximum number of GLSL varying vectors allowed in each shader program.

- (GLuint) maxNumberOfTextureUnits
readnonatomicassign

Returns the maximum number of texture units supported by the platform, or zero if the platform does not impose a limit.

- (GLuint) maxNumberOfVertexAttributes
readnonatomicassign

Returns the maximum number of vertex attributes supported by the platform, or zero if the platform does not impose a limit.

- (GLuint) maxNumberOfVertexShaderUniformVectors
readnonatomicassign

Returns the maximum number of GLSL uniform vectors allowed in each vertex shader.

- (GLuint) maxRenderbufferSize
readnonatomicassign

Returns the maximum size for a renderbuffer supported by the platform.

- (GLuint) maxTextureSize
readnonatomicassign

Returns the maximum size for a 2D texture supported by the platform.

- (CC3ShaderPrewarmer*) shaderProgramPrewarmer
readwritenonatomicretain

The shader prewarmer for this context.

When loading, compiling and linking a shader program, some of the steps are deferred, within the GL engine, until the shader is first used to draw a mesh. This can result in a significant, unexpected, and undesired pause during the GL draw call.

This prewarmer can be used to force that first draw call to be made immediately, and to an off-screen surface, so it won't be visible.


The documentation for this class was generated from the following file: