Jump to content

[SOLVED] Auxiliary texture from the renderer not displayed in WidgetSpriteViewport


photo

Recommended Posts

I have assigned auxiliary textures to all the objects in my world and I am able to save the auxiliary texture to images by auxiliaryTexture->getImage(image), which are correct. But when I try to display this image in the WidgetSpriteViewport by WidgetSpriteViewportPtr segm; segm->setImage(image); it does not get displayed. segm->setRender(auxiliaryTexture); does not work either. The Widget has suitable size and is added to the Gui.

Link to comment

I have the Texture::USAGE_RENDER flag.

 

    vsize = TEXTURE_SIZE

    auxiliaryTexture = Texture::create();
    auxiliaryTexture->create2D(TEXTURE_SIZE, TEXTURE_SIZE,  Texture::FORMAT_RGBA8, Texture::USAGE_RENDER);
    segm = WidgetSpriteViewport::create(Gui::get(), vsize, vsize);
    segm->setPosition(0, App::get()->getHeight() - vsize);
    Gui::get()->addChild(segm->getWidget(), Gui::ALIGN_OVERLAP |
                                              Gui::ALIGN_BACKGROUND |
                                              Gui::ALIGN_EXPAND);

then later:

     auxiliaryTexture->getImage(image);
     segm->setRender(auxiliaryTexture); //doesn't work
     segm->setImage(image, 1); //doesn't work
     unsigned char *pixel_arr = image->getPixels();
     String save_path = String::format("Outputs/image_%d_y.png", time);
     image->save(save_path); //the image saved here is correct

 

 

Link to comment

Hi Luuk,

setImage and setRender methods are valid only for the simple WidgetSprite (basically you change the background texture of sprite by doing this). It's not possible to do the same thing with WidgetSpriteViewport. We will update documentation to cover that or maybe also change an API to be more user friendly.

Right now it's not completely clear what do you want to achieve with that code. If you can provide us some more information - maybe we will find another solution for your task.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi Luuk,

As far as I know terrain object doesn't have a Aux pass, so it would be rendered black if we will decide to render an aux buffer contents in this viewport. Do you only need to render your drone with a solid color and leave all other objects unchanged?

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • silent changed the title to [SOLVED] Auxiliary texture from the renderer not displayed in WidgetSpriteViewport
×
×
  • Create New...