cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.koboldtouch.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
CCGLView Class Reference

#import <CCGLView.h>

Inheritance diagram for CCGLView:
Collaboration diagram for CCGLView:

Instance Methods

(id) - initWithFrame:
 
(id) - initWithFrame:pixelFormat:
 
(id) - initWithFrame:pixelFormat:depthFormat:preserveBackbuffer:sharegroup:multiSampling:numberOfSamples:
 
(void) - swapBuffers
 
(void) - lockOpenGLContext
 
(void) - unlockOpenGLContext
 
(CGPoint) - convertPointFromViewToSurface:
 
(CGRect) - convertRectFromViewToSurface:
 

Class Methods

(id) + viewWithFrame:
 
(id) + viewWithFrame:pixelFormat:
 
(id) + viewWithFrame:pixelFormat:depthFormat:
 
(id) + viewWithFrame:pixelFormat:depthFormat:preserveBackbuffer:sharegroup:multiSampling:numberOfSamples:
 

Protected Attributes

id< CCESRenderer_renderer
 
EAGLContext * _context
 
NSString * _pixelformat
 
GLuint _depthFormat
 
BOOL _preserveBackbuffer
 
CGSize _size
 
BOOL _discardFramebufferSupported
 
id< CCTouchDelegate_touchDelegate
 
BOOL _multisampling
 
unsigned int _requestedSamples
 

Properties

NSString * pixelFormat
 
GLuint depthFormat
 
CGSize surfaceSize
 
EAGLContext * context
 
BOOL multiSampling
 
id< CCTouchDelegatetouchDelegate
 

Detailed Description

CCGLView Class. This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass. The view content is basically an EAGL surface you render your OpenGL scene into. Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.

Parameters:

  • viewWithFrame: size of the OpenGL view. For full screen use [_window bounds]
    • Possible values: any CGRect
  • pixelFormat: Format of the render buffer. Use RGBA8 for better color precision (eg: gradients). But it takes more memory and it is slower
    • Possible values: kEAGLColorFormatRGBA8, kEAGLColorFormatRGB565
  • depthFormat: Use stencil if you plan to use CCClippingNode. Use Depth if you plan to use 3D effects, like CCCamera or CCNode::vertexZ
    • Possible values: 0, GL_DEPTH_COMPONENT24_OES, GL_DEPTH24_STENCIL8_OES
  • sharegroup: OpenGL sharegroup. Useful if you want to share the same OpenGL context between different threads
    • Possible values: nil, or any valid EAGLSharegroup group
  • multiSampling: Whether or not to enable multisampling
    • Possible values: YES, NO
  • numberOfSamples: Only valid if multisampling is enabled
    • Possible values: 0 to glGetIntegerv(GL_MAX_SAMPLES_APPLE)

Method Documentation

- (id) initWithFrame: (CGRect)  frame

Initializes an CCGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer

- (id) initWithFrame: (CGRect)  frame
pixelFormat: (NSString *)  format 

Initializes an CCGLView with a frame, a color buffer format, and 0-bit depth buffer

- (id) initWithFrame: (CGRect)  frame
pixelFormat: (NSString *)  format
depthFormat: (GLuint)  depth
preserveBackbuffer: (BOOL)  retained
sharegroup: (EAGLSharegroup *)  sharegroup
multiSampling: (BOOL)  sampling
numberOfSamples: (unsigned int)  nSamples 

Initializes an CCGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support

- (void) lockOpenGLContext

uses and locks the OpenGL context

- (void) swapBuffers

CCGLView uses double-buffer. This method swaps the buffers

- (void) unlockOpenGLContext

unlocks the openGL context

+ (id) viewWithFrame: (CGRect)  frame

creates an initializes an CCGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer.

+ (id) viewWithFrame: (CGRect)  frame
pixelFormat: (NSString *)  format 

creates an initializes an CCGLView with a frame, a color buffer format, and 0-bit depth buffer.

+ (id) viewWithFrame: (CGRect)  frame
pixelFormat: (NSString *)  format
depthFormat: (GLuint)  depth 

creates an initializes an CCGLView with a frame, a color buffer format, and a depth buffer.

+ (id) viewWithFrame: (CGRect)  frame
pixelFormat: (NSString *)  format
depthFormat: (GLuint)  depth
preserveBackbuffer: (BOOL)  retained
sharegroup: (EAGLSharegroup *)  sharegroup
multiSampling: (BOOL)  multisampling
numberOfSamples: (unsigned int)  samples 

creates an initializes an CCGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisamping

Property Documentation

- (EAGLContext*) context
readnonatomicassign

OpenGL context

- (GLuint) depthFormat
readnonatomicassign

depth format of the render buffer: 0, 16 or 24 bits

- (NSString*) pixelFormat
readnonatomicassign

pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit)

- (CGSize) surfaceSize
readnonatomicassign

returns surface size in pixels

- (id<CCTouchDelegate>) touchDelegate
readwritenonatomicassign

touch delegate


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