Recently I am writting game editor in my project. I want to implement a editor which has four viewport like 3ds max or other 3D software.
So, how to use opengles2 to render context on multi-window?
Recently I am writting game editor in my project. I want to implement a editor which has four viewport like 3ds max or other 3D software.
So, how to use opengles2 to render context on multi-window?
You can usually have multiple views with each having its own frame buffer. In this case all you need to do is bind the correct frame buffer before drawing to each of the views. You might also need to have different contexts for each view and setting them as current before drawing (also before binding the frame buffer). If you need multiple contexts you will need to find a way to share resources between them though.
Another approach is having a single view and simply using
glViewport
to draw to different parts. In this case you need to setglViewport
for a specific part, settingortho
orfrustum
(if view segments are of different size) and that is it. For instance if you split the view with buffer having dimensionsbWidth
andbHeight
into 4 equal rectangles and you want to refresh the top right:and when you are finished with all you want to update just present the frame buffer.