Jump to content

[SOLVED] Viewport::renderImage2D problem


photo

Recommended Posts

Hello!
 

I want to view Splash image during the pause of exercise in my simulation. I read that it is impossible to do this with Unigine::Splash Class. So I tried to implement that idea using Viewport::renderImage2D() function.

 

Example of test code:

 

int AppWorldLogic::update()

{

ImagePtr pSplashImage = Image::create("defaultSplash");

pSplashImage->load("/home/userauto/workspace/TwrSim_Settings/defaultSplash.jpg");

ViewportPtr pSplashViewPort = Viewport::create();

pSplashViewPort->renderImage2D(Game::get()->getPlayer()->getCamera(), pSplashImage);

Render::get()->setViewport(pSplashViewPort);

 

return 1;

}

 

I think that line of code is working

Render::get()->setViewport(pSplashViewPort);

 

Because I see blinks at my screen and fps is going to become very low( 15-20 ). And I see my default viewport that i have set up using SDK browser anyway.

 

Also in log file i have that warning:

ImageFile::load(): unknown format of "defaultSplash" file. But it is okay with it. It has .jpg format.

 

What am I doing wrong?

Link to comment

Hi Grigorij,

 

Viewport::renderImage2D is not designed to render the desired image on top of the scene. You can check three main usages of Viewport class in documentation: https://developer.unigine.com/en/docs/2.3.1/api/library/rendering/class.viewport

 

In your case It's better to render fullscreen WIdgetSprite with desired texture instead of using complicated logic with Splashes.

 

Thanks!

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

Link to comment
  • silent changed the title to [SOLVED] Viewport::renderImage2D problem
×
×
  • Create New...