简体   繁体   中英

Render OpenGL scene at two different locations

I am writing an application that renders an OpenGL scene. This application has two windows:

  1. A large window that shows only the rendered scene
  2. A "control window" that offers several settings and a preview of the rendered scene

This application is written in .NET (for the control window part) and uses a native C++ DLL to create the rendering window and do the actual OpenGL rendering.

This works fine, but one important part is still missing: getting a live preview of the rendered scene into my .NET control window.

So far I could think of two solutions:

  1. Render the scene not only to the screen, but also to memory. Then shove that blob of memory to my .NET WinForm. Finally draw the image to a PictureBox or something. <- This sounds horribly slow!
  2. Make my native OpenGL renderer render the scene twice, once to the native full size window, once to a control (panel?) on my .NET form.

Option 2 sounds faster, but I have no idea if/how that even works. Can this be done? Are there better alternatives?

Look into the documentation on framebuffers . It is basically the destination of your rendering, by default it's your viewport (or the backbuffer , which switches with the displayed buffer once it's ready).

The first option should generally be faster as you render the scene once and then just basically copy a texture.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM