Exemple #1
0
        /**
         * Constructs a new <code>WorldWindowGLCanvas</code> on a specified device with the specified capabilities and
         * shares graphics resources with another <code>WorldWindow</code>.
         *
         * @param shareWith a <code>WorldWindow</code> with which to share graphics resources.
         * @param device       the <code>GraphicsDevice</code> on which to create the window. May be null, in which case the
         *                     default screen device of the local {@link GraphicsEnvironment} is used.
         * @param capabilities a capabilities object indicating the OpenGL rendering context's capabilities. May be null, in
         *                     which case a default set of capabilities is used.
         * @param chooser      a chooser object that customizes the specified capabilities. May be null, in which case a
         *                     default chooser is used.
         *
         * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser,
         *      javax.media.opengl.GLContext, java.awt.GraphicsDevice)
         */
        public WorldWindowGLCanvas(WorldWindow shareWith, java.awt.GraphicsDevice device,
                                   GLCapabilities capabilities, GLCapabilitiesChooser chooser)
        {
            base(capabilities, chooser, device);

            if (shareWith != null)
            {
                this.setSharedContext(shareWith.getContext());
            }

            try
            {
                this.wwd = ((WorldWindowGLDrawable)WorldWind.createConfigurationComponent(AVKey.WORLD_WINDOW_CLASS_NAME));
                this.wwd.initDrawable(this);
                if (shareWith != null)
                {
                    this.wwd.initGpuResourceCache(shareWith.getGpuResourceCache());
                }
                else
                {
                    this.wwd.initGpuResourceCache(WorldWindowImpl.createGpuResourceCache());
                }
                this.createView();
                this.createDefaultInputHandler();
                WorldWind.addPropertyChangeListener(WorldWind.SHUTDOWN_EVENT, this);
                this.wwd.endInitialization();
            }
            catch (Exception e)
            {
                String message = Logging.getMessage("Awt.WorldWindowGLSurface.UnabletoCreateWindow");
                Logging.logger().severe(message);
                throw new WWRuntimeException(message, e);
            }
        }
    public static double getGamma(GraphicsDevice screen)
    {
      ColorSpace colorSpace = screen.getDefaultConfiguration().getColorModel().getColorSpace();
      if (colorSpace.isCS_sRGB())
        return 2.2;
      double num1;
      try
      {
        num1 = (double) ((ICC_ProfileRGB) ((ICC_ColorSpace) colorSpace).getProfile()).getGamma(0);
      }
      catch (Exception ex)
      {
        int num2 = 2;
        if (ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num2) == null)
          throw;
        else
          goto label_6;
      }
      return num1;
label_6:
      return 0.0;
    }