Class CCRenderTexture

#include <Geode/cocos/misc_nodes/CCRenderTexture.h>
classCCRenderTexture:publiccocos2d::CCNode{ ... }

Since v0.8.1

CCRenderTexture is a generic rendering target. To render things into it, simply construct a render target, call begin on it, call visit on any cocos scenes or objects to render them, and call end. For convenience, render texture adds a sprite as it’s display child with the results, so you can simply add the render texture to your scene and treat it like any other CocosNode. There are also functions for saving the render texture to disk in PNG or JPG format.

Examples0
Public static methods3
staticcocos2d::CCRenderTexture*create(,,,
GLuintuDepthStencilFormat
)

initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format

staticcocos2d::CCRenderTexture*create(,,)

creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid

staticcocos2d::CCRenderTexture*create(,)

creates a RenderTexture object with width and height in Points, pixel format is RGBA8888

Public member functions31
virtualcocos2d::CCSprite*getSprite()
No description provided
virtualvoidsetSprite()
No description provided
virtualvoidvisit()
No description provided
virtualvoiddraw()
No description provided
boolinitWithWidthAndHeight(,,)

initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid

boolinitWithWidthAndHeight(,,,
GLuintuDepthStencilFormat
)

initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format

voidbegin()

starts grabbing

voidbeginWithClear(,,,)

starts rendering to the texture while clearing the texture first. This is more efficient then calling -clear first and then -begin

voidbeginWithClear(,,,,
floatdepthValue
)

starts rendering to the texture while clearing the texture first. This is more efficient then calling -clear first and then -begin

voidbeginWithClear(,,,,
floatdepthValue
,
intstencilValue
)

starts rendering to the texture while clearing the texture first. This is more efficient then calling -clear first and then -begin

voidendToLua()

end is key word of lua, use other name to export to lua.

voidend()

ends grabbing

voidclear(,,,)

clears the texture with a color

voidclearDepth(
floatdepthValue
)

clears the texture with a specified depth value

voidclearStencil(
intstencilValue
)

clears the texture with a specified stencil value

cocos2d::CCImage*newCCImage(
boolflipImage
)
No description provided
boolsaveToFile(
charconst*szFilePath
)

saves the texture into a file using JPEG format. The file will be saved in the Documents folder. Returns YES if the operation is successful.

boolsaveToFile(,)

saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder. Returns YES if the operation is successful.

voidlistenToBackground()

Listen “come to background” message, and save render texture. It only has effect on Android.

voidlistenToForeground()

Listen “come to foreground” message and restore the frame buffer object It only has effect on Android.

uintgetClearFlags()const

Valid flags: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT. They can be OR’ed. Valid when “autoDraw is YES.

voidsetClearFlags(
uintuClearFlags
)
No description provided
cocos2d::ccColor4Fconst&getClearColor()const

Clear color value. Valid only when “autoDraw” is true.

voidsetClearColor()
No description provided
floatgetClearDepth()const

Value for clearDepth. Valid only when autoDraw is true.

voidsetClearDepth(
floatfClearDepth
)
No description provided
intgetClearStencil()const

Value for clear Stencil. Valid only when autoDraw is true

voidsetClearStencil(
floatfClearStencil
)
No description provided
boolisAutoDraw()const

When enabled, it will render its children into the texture automatically. Disabled by default for compatiblity reasons. Will be enabled in the future.

voidsetAutoDraw(
boolbAutoDraw
)
No description provided
voidupdateInternalScale(,)
No description provided
Fields0
Protected member functions0
Protected fields13
;
No description provided
GLuintm_uFBO
;
No description provided
GLuintm_uDepthRenderBufffer
;
No description provided
GLintm_nOldFBO
;
No description provided
;
No description provided
cocos2d::CCTexture2D*m_pTextureCopy
;
No description provided
cocos2d::CCImage*m_pUITextureImage
;
No description provided
GLenumm_ePixelFormat
;
No description provided
GLbitfieldm_uClearFlags
;
No description provided
cocos2d::ccColor4Fm_sClearColor
;
No description provided
GLclampfm_fClearDepth
;
No description provided
GLintm_nClearStencil
;
No description provided
boolm_bAutoDraw
;
No description provided