Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Image Data In RenderTexture::newImage Callback #20776

Open
Diam2023 opened this issue Jul 18, 2023 · 0 comments
Open

Null Image Data In RenderTexture::newImage Callback #20776

Diam2023 opened this issue Jul 18, 2023 · 0 comments

Comments

@Diam2023
Copy link

  • cocos2d-x version: 4.0
  • devices test on: Windows 11 Pro
  • developing environments
    • IDE: Clion 2023.1.3
    • Toolchain: Visual Studio
    • Generator: Visual Studio 17 2022
    • CMake: 3.26.3

When Run Code:

        RenderTexture* pRender = RenderTexture::create(
            static_cast<int>(tmpSprite->getContentSize().width),
            static_cast<int>(tmpSprite->getContentSize().height),
            backend::PixelFormat::RGBA8888);

//        pRender->setSprite(tmpSprite);
        pRender->begin();
        tmpSprite->visit();
        pRender->end();

        pRender->newImage([role](Image* image) {
            auto polygon = ImageAutoPolygon::generatePolygon(image);
            role->initWithPolygon(polygon);
            // role->updatePoly();
            role->setVisible(true);
        });

In line
auto polygon = ImageAutoPolygon::generatePolygon(image);
You Will get a incomplete Image Instance
Because Image::_data is null data
Like This:
image

When Use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant