【问题标题】:In cocos2dx, I use RenderTexture to capture the screen, but images in scrollview are lostcocos2dx中,我使用RenderTexture截屏,但是scrollview中的图片丢失了
【发布时间】:2017-01-05 05:26:21
【问题描述】:

在我捕获屏幕后:

auto renderTexture = RenderTexture::create(width, height,Texture2D::PixelFormat::RGBA8888, GL_DEPTH24_STENCIL8_OES);
Scene* curScene = Director::getInstance()->getRunningScene();
renderTexture->begin();
curScene->visit();
Director::getInstance()->getRenderer()->render();
renderTexture->end();

滚动视图中位于屏幕外的图像和文本会像这样丢失: 1.正常图像 The bottom is outside of the screen

the result after capture screen

【问题讨论】:

    标签: ios scrollview cocos2d-x texture2d


    【解决方案1】:

    引擎会从屏幕中剔除精灵(在函数Sprite::draw)以获得更高的性能。您可以通过修改宏 CC_USE_CULLING(cocos/base/ccConfig.h 处的宏来关闭它,或者您可以在捕获屏幕时移动屏幕中的对象并在渲染完成后将它们移回。

    【讨论】:

    • 很有用,非常感谢
    猜你喜欢
    • 2017-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多