【问题标题】:Cocos2d Android CCRenderTexture exampleCocos2d Android CCRenderTexture 示例
【发布时间】:2012-05-15 07:23:57
【问题描述】:
CCSprite texture1 = CCSprite.sprite("menu_background.png");
CCRenderTexture layerRenderTexture = CCRenderTexture.renderTexture(width, height);
layerRenderTexture.begin();
texture1.visit(CCDirector.gl);
layerRenderTexture.end();
this.addChild(layerRenderTexture);

我没有在 Internet 上看到任何 CCRenderTexture 示例。当我尝试如上所述使用它时,我希望看到一个漂亮的背景。相反,我看到黑色:)

我做错了什么? 感谢您的帮助。

【问题讨论】:

    标签: android cocos2d-iphone cocos2d-android


    【解决方案1】:

    我没有在 Internet 上看到任何 CCRenderTexture 示例。

    我认为您可能一直在寻找错误的互联网? :)

    查看my articleRay's article。当您在谷歌搜索 CCRenderTexture 时,两者都名列前茅。他们使用 cocos2d-iphone,但原理相同。

    在您的特定情况下,我没有看到您将 layerRenderTexture 作为子节点添加到场景或其他节点中。这可以解释为什么你没有得到任何结果。

    【讨论】:

    • 首先感谢您的回复:) 我已经开发并完成了我的 iPhone 项目。现在我正在尝试在 Android 上实现它。在你发给我的链接中,它是关于 Iphone 而不是 Android 上的 Cocos2d 的。顺便说一句,我当然已经将 layerRenderTexture 作为子图层添加到图层中。我知道原理和 iPhone 一样,但是我在 Android 上无法实现。
    • 远射,也许您遇到了这个问题? code.google.com/p/cocos2d-android-1/issues/detail?id=71
    • 你有什么解决办法吗?
    • “我想你可能一直在寻找错误的互联网?” :) 你在正确的互联网上找到什么了吗? :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多