What are the performance implications of multiple windows with indivdual OpenGL contexts?

For an engine I'm developing I've decided to allow users to set up multiple windows showing differing views of the same "world." This is being developed using OpenGL (hopefully aiming for 3.2 core eventually if that affects the ansmer) and SDL 1.3. The basic structure I've got set up is:

class Window {
SDL_Window *sdl_window;
SDL_GLContext context;

Window(...) {
sdl_window = SDL_CreateWindow(...);

// Rest of the setup of world etc.
}

gl_init() {
context = SDL_GL_CreateContext(sdl_window);

// Set up initial OpenGL settings.
}

render() {
SDL_GL_MakeCurrent(sdl_window, context);

// Rendering the world.

SDL_GL_SwapWindow(sdl_window);
}
}


This all compiles and runs fine with the rest of the demo code I've developed so far, simply showing a pair of slightly offset views. However, there's no really performance heavy stuff implemented yet.

• Is this the correct approach to use?
• Are there any major performance implications with switching the context twice (or more) a frame? (other than the expected double (or more) rendering occurring).
• For example, does switching contexts force a flush of the graphics memory to the system RAM or something equally frame-rate killing?
• Is there an alternative method that would allow setting up two different viewpoints and rendering them in one pass?
• If this is the best way to do it is there a way of sharing data between contexts? I'm thinking once I switch to VBO's over display lists, if the views overlap in some way they should be sharing VBO's for that portion.

If all you're using these two windows to do is to have two viewports into the same scene, that's really not necessary. You can do that with one context and one window. Just use glViewport and glScissor to set up multiple views within the same window. You set one view, render stuff, then you set up another view, and render stuff to that.