Context switching speed question ?

Hi !

Context switching is slow, but how slow is it. If I want an ordinary 3D modeler setup with 4 views of a scene, would it be fastest to create 4 windows with one OpenGL context for each window or to use one window with one context and render the scene 4 times in this window instead (one time in each quadrant) ?


Depends a little on your system (CPUs and graphics board.)

For some reasons it might be more effective to work in one window with four do-it-yourself viewport.

  • Textures and display lists don’t need to be shared.
  • Clears and SwapBuffers only have to be done once and may be faster that way.
  • Simultaneous updates in multiple viewports easier because of single window message handler.
  • Lots of other things…

But you’ll have to fuzz around with the viewport dimensions and display borders yourself (don’t use GDI!). Even some highend apps do this, so you’re in good company.


it is very slow, really. I know it from my experience. You’ll maybe loose a week to make fully featured view with 4 viewports, but it is worth…Not olny for speed, but also for the display lists and the textures, as Relic pointed… A easy way to do it, is to implement a class CViewport with the local viewport’s properties. Some mess is to be expected with the mouse coords mapping, but if you have problems, I may e-mail you some code for these things…

Hope this helps