helmut.bressler Posted May 11, 2015 Posted May 11, 2015 Hello Unigine Team, I'm using the AppBorder plugin source code as template for porting my supersampling App class to Opengl (we are very excited about the new PBR rendering and cannot wait until the direct3d version is implemented :-) So far this works quite well, with only some minor modifications to the AppBorder source code. The only thing which does not work is the engine.visualizer, it is not drawing anything at all. I suspect it is getting deactivated in the following lines (source/plugins/App/AppBorder/AppBorder.cpp) // render interface render->setEnabled(0); App::render(); This problem is easy to reproduce, I created a project from scratch and I'm using the following update() and render() unigine script functions: int update() { engine.visualizer.setEnabled(1); #ifdef HAS_APP_BORDER engine.border.setBorder(0); log.message("AppBorder is ENABLED\n"); #endif return 1; } int render() { string debugText = "Hello World!"; #ifdef HAS_APP_BORDER debugText += "\nAppBorder is ENABLED\n"; #endif engine.visualizer.renderMessage2D(vec3(0.5f, 0.5f, 0.05f), vec3(1, 1, 0), debugText, vec4(1, 0, 0, 1), 1); return 1; } When the AppBorder plugin is enabled the text rendered via engine.visualizer.renderMessage2D() does not appear on the screen. Is there a simple simple way to fix that, either in the AppBorder source code or via unigine script? Thank you and cheers! Helmut
unclebob Posted May 13, 2015 Posted May 13, 2015 Hi Helmut! Thanks for test sample! I'll see what I can do with that and report back.
unclebob Posted June 1, 2015 Posted June 1, 2015 Helmut, Please take my apologies for very late reply yet I have found a source of the problem. During AppBorder rendering, it's calling render->renderViewport without visualizer flag set. If you have a look at function signature you may notice that it has "visualizer" argument with default value set to zero: virtual void Unigine::Render::renderViewport(const mat4 &projection,const UNIGINE_MAT4 &modelview,const char *materials,int viewport_mask,int reflection_mask,int shadows,int visualizer = 0); So the solution is to call renderViewport and set 1 to that argument, so this: // render textures texturerender->setColorTexture(0,texture); texturerender->enable(); render->renderViewport(projection,modelview,materials.get(),viewport_mask,reflection_mask,1); texturerender->flush(); texturerender->disable(); Would become this: // render textures texturerender->setColorTexture(0,texture); texturerender->enable(); render->renderViewport(projection,modelview,materials.get(),viewport_mask,reflection_mask,1,1); // one more argument here for visualizer texturerender->flush(); texturerender->disable(); However, this feature is only available in 2.0.
Recommended Posts