Search the Community
Showing results for tags 'renderImage2D'.
-
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?
-
Hi, We're working on an "instant replay" by using engine.render.renderImage2D() to capture frames and then play them back a moment later. The routine is pasted below. But when we play back the images they're significantly darker than the view through the camera in the main Unigine window. Is there something we're missing about how to use renderImage2D() ? void buffer_and_playback() { Image images[0]; Player play = engine.game.getPlayer(); Camera cam = play.getCamera(); log.message("Start capture\n"); forloop(int i = 0; 75) { images.append(new Image()); engine.render.renderImage2D(cam, images[i], 0); sleep(1.0f/25.0f); } log.message("Capture done. Playback start\n"); sleep(2.0f); WidgetSprite ws = new WidgetSprite(engine.getGui()); engine.gui.addChild(ws, GUI_ALIGN_OVERLAP | GUI_ALIGN_LEFT); forloop(int i = 0; images.size()) { ws.setImage(images[i]); sleep(5.0f/25.0f); delete images[i]; } engine.gui.removeChild(ws); log.message("PLayback done\n"); }