Jump to content

[SOLVED] Exporting framebuffer to 3rd part app


photo

Recommended Posts

Suppose I have 3rd part application for image postprocessing. I need to export the result rendered scene framebuffer somehow. What I need is the 640x480 picture (texture) which shows the current shrinked down framebuffer which is exported to another app for further operations.

 

My initial idea is to use the shared memory, but I got stucked just at the starting point, as I do not know how to get the access to Unigine's framebuffer. Should it be proceeded at the operating system level, or I have another option to use some of Unigine's API, which actually is what I pray for :)

 

Link to comment
  • 2 weeks later...

Hi there!

 

Sorry for late reply.

 

You can render scene into texture by several ways:

 

1) Use Render::renderImage2D (https://developer.unigine.com/en/docs/1.0/cpp_api/reference/api_render_class), it's a C++ version of engine.render.renderImage2D function (https://developer.unigine.com/en/docs/1.0/scripting/library/engine/engine.render#engine.render.renderImage2D_mat4_mat4_Image_int_int_string_int)

 

By doing this your framebuffer will be copied from video memory to system memory.

 

2) Create a TextureRender (https://developer.unigine.com/en/docs/1.0/cpp_api/reference/api_texturerender_class), create a Texture (https://developer.unigine.com/en/docs/1.0/cpp_api/reference/api_texture_class), set the texture to the texture render and draw a scene by using Render::renderViewport method.

 

This won't copy framebuffer to system memory leaving your texture in video memory. You're able to copy rendered texture to system memory via Texture::getImage method. Please look at AppPanorama code, it clearly shows how to use TextureRender class.

Link to comment
×
×
  • Create New...