diff --git a/cocos/2d/CCCamera.cpp b/cocos/2d/CCCamera.cpp index 443aac7669..2708d845ea 100644 --- a/cocos/2d/CCCamera.cpp +++ b/cocos/2d/CCCamera.cpp @@ -475,6 +475,11 @@ void Camera::applyFrameBufferObject() } } +void Camera::apply() +{ + applyFrameBufferObject(); +} + int Camera::getRenderOrder() const { int result(0); diff --git a/cocos/2d/CCCamera.h b/cocos/2d/CCCamera.h index bfd18e1400..dc6532ec8e 100644 --- a/cocos/2d/CCCamera.h +++ b/cocos/2d/CCCamera.h @@ -213,9 +213,17 @@ public: * Get the default camera of the current running scene. */ static Camera* getDefaultCamera(); - + /** + Before rendering scene with this camera, the background need to be cleared. + */ void clearBackground(float depth); - + /** + Apply the FBO, RenderTargets and viewport. + */ + void apply(); + /** + Set FBO, which will attacha several render target for the rendered result. + */ void setFrameBufferObject(FrameBufferObject* fbo); void setViewport(const Viewport& vp) { _viewport = vp; } CC_CONSTRUCTOR_ACCESS: diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index dacc995fb1..448a94d8c7 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -164,7 +164,7 @@ void Scene::render(Renderer* renderer) director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix()); - camera->applyFrameBufferObject(); + camera->apply(); //clear background with max depth camera->clearBackground(1.0); //visit the scene