package org.helioviewer.viewmodel.view.opengl;

import javax.media.opengl.GLContext;

/**
 * Class to manage the OpenGL context, in case of multiple OpenGL elements in
 * the GUI.
 *
 * <p>
 * Since OpenGL manages resources separately per context, having multiple
 * contexts might result in unpredictable behavior. To avoid that, all OpenGl
 * GUI elements should share one context.
 *
 * @author Markus Langenberg
 *
 */
public class GLSharedContext {
    private static GLContext context = null;

    /**
     * Sets the shared OpenGL context.
     *
     * This functions assign a new context only one time, every following call
     * is ignored.
     *
     * @param sharedContext
     */
    public static void setSharedContext(GLContext sharedContext) {
        if (context == null) {
            context = sharedContext;
        }
    }

    /**
     * Returns the shared OpenGL context.
     *
     * @return Shared context
     */
    public static GLContext getSharedContext() {
        return context;
    }

}

@@ -643,17 +643,67 @@
  ignored
-.
+, unless it is being tried to reset to null.%0A     *
 %0A     *%0A
@@ -827,16 +827,41 @@
 ntext ==
+ null %7C%7C sharedContext ==
  null) %7B

Fix switching 3D->2D->3D->2D modes