CCGLView Class Reference
Inherits from | UIView |
---|---|
Conforms to | CCDirectorView |
Declared in | CCGLView.h |
Overview
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.
This class is normally set up for you in the AppDelegate instance of the Cocos2D project template, but you may need to create it yourself in mixed UIKit / Cocos2D apps or tweak some of its parameters, for instance to enable the framebuffer’s alpha channel in order to see views underneath the CCGLView.
Note: Setting the view non-opaque will only work if the pixelFormat is also set to kEAGLColorFormatRGBA8
upon initialization.
Note: This documentation is for the iOS version of the class. OS X use specific variants of CCGLView which inherit from other base classes (ie NSOpenGLView on OS X).
Parameters:
viewWithFrame
: size of the OpenGL view. For full screen use_window.bounds
.pixelFormat
: Format of the render buffer. UsekEAGLColorFormatRGBA8
for better color precision (eg: gradients) at the expense of doubling memory usage and performance.- Possible values:
kEAGLColorFormatRGBA8
,kEAGLColorFormatRGB565
- Possible values:
depthFormat
: Use stencil if you plan to use CCClippingNode. Use depth if you plan to use 3D effects.- Possible values:
0
,GL_DEPTH_COMPONENT24_OES
,GL_DEPTH24_STENCIL8_OES
- Possible values:
sharegroup
: OpenGL sharegroup. Useful if you want to share the same OpenGL context between different threads.multiSampling
: Whether or not to enable multisampling.numberOfSamples
: Only valid if multisampling is enabled- Possible values: any integer in the range
0
(off) toglGetIntegerv(GL_MAX_SAMPLES_APPLE)
where the latter is device-dependent.
- Possible values: any integer in the range