diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index 90799f9c0b..f39bbba933 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -693,6 +693,7 @@ void Renderer::clear() { //Enable Depth mask to make sure glClear clear the depth buffer correctly glDepthMask(true); + glClearColor(_clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDepthMask(false); @@ -1060,7 +1061,6 @@ bool Renderer::checkVisibility(const Mat4 &transform, const Size &size) void Renderer::setClearColor(const Color4F &clearColor) { _clearColor = clearColor; - glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); } NS_CC_END diff --git a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp index a7894dde43..19e55563c0 100644 --- a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp +++ b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp @@ -1435,8 +1435,21 @@ void CameraFrameBufferObjectTest::onEnter() auto fbo = FrameBufferObject::create(1, sizeInpixels.width, sizeInpixels.height); CameraBaseTest::onEnter(); - auto sprite = Sprite::createWithTexture(fbo); + //auto sprite = Sprite::createWithTexture(fbo); + //sprite->setPosition(Vec2(100,100)); + std::string filename = "Sprite3DTest/girl.c3b"; + auto sprite = Sprite3D::create(filename); + sprite->setScale(1.0); + auto animation = Animation3D::create(filename); + if (animation) + { + auto animate = Animate3D::create(animation); + + sprite->runAction(RepeatForever::create(animate)); + } sprite->setPosition(Vec2(100,100)); + sprite->setTexture(fbo); + addChild(sprite); auto sprite2 = Sprite::create(s_pathGrossini); @@ -1455,5 +1468,6 @@ void CameraFrameBufferObjectTest::onEnter() camera->setCameraFlag(CameraFlag::USER1); camera->setDepth(-1); camera->setFrameBufferObject(fbo); + fbo->setClearColor(Color4F(1,1,1,1)); addChild(camera); }