Beispiel #1
0
        /**
         * See {@link GLEventListener#init(GLAutoDrawable)}.
         *
         * @param glAutoDrawable the drawable
         */
        public void init(GLAutoDrawable glAutoDrawable)
        {
            if (!this.isGLContextCompatible(glAutoDrawable.getContext()))
            {
                String msg = Logging.getMessage("WorldWindowGLAutoDrawable.IncompatibleGLContext",
                                                glAutoDrawable.getContext());
                this.callRenderingExceptionListeners(new WWAbsentRequirementException(msg));
            }

            foreach (String funcName in this.getRequiredOglFunctions())
            {
                if (!glAutoDrawable.getGL().isFunctionAvailable(funcName))
                {
                    //noinspection ThrowableInstanceNeverThrown
                    this.callRenderingExceptionListeners(new WWAbsentRequirementException(funcName + " not available"));
                }
            }

            foreach (String extName in this.getRequiredOglExtensions())
            {
                if (!glAutoDrawable.getGL().isExtensionAvailable(extName))
                {
                    //noinspection ThrowableInstanceNeverThrown
                    this.callRenderingExceptionListeners(new WWAbsentRequirementException(extName + " not available"));
                }
            }

            if (this.firstInit)
            {
                this.firstInit = false;
            }
            else if (this.enableGpuCacheReinitialization)
            {
                this.reinitialize(glAutoDrawable);
            }

            // Disables use of the OpenGL extension GL_ARB_texture_rectangle by JOGL's Texture creation utility.
            //
            // Between version 1.1.1 and version 2.x, JOGL modified its texture creation utility to favor
            // GL_ARB_texture_rectangle over GL_ARB_texture_non_power_of_two on Mac OS X machines with ATI graphics cards. See
            // the following URL for details on the texture rectangle extension: http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt
            //
            // There are two problems with favoring texture rectangle for non power of two textures:
            // 1) As of November 2012, we cannot find any evidence that the GL_ARB_texture_non_power_of_two extension is
            //    problematic on Mac OS X machines with ATI graphics cards. The texture rectangle extension is more limiting
            //    than the NPOT extension, and therefore not preferred.
            // 2) World Wind assumes that a texture's target is always GL_TEXTURE_2D, and therefore incorrectly displays
            //    textures with the target GL_TEXTURE_RECTANGLE.
            TextureIO.setTexRectEnabled(false);

//        this.drawable.setGL(new DebugGL(this.drawable.getGL())); // uncomment to use the debug drawable
        }
Beispiel #2
0
        public void initDrawable(GLAutoDrawable glAutoDrawable)
        {
            if (glAutoDrawable == null)
            {
                String msg = Logging.getMessage("nullValue.DrawableIsNull");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            this.drawable = glAutoDrawable;
            this.drawable.setAutoSwapBufferMode(false);
            this.drawable.addGLEventListener(this);
        }