/**
         * Initialize this GLRuntimeCapabilities from the specified {@link javax.media.opengl.GLContext}. The context's
         * runtime GL capabilities are examined, and the properties of this GLRuntimeCapabilities are modified accordingly.
         * Invoking initialize() may change any property of this GLRuntimeCapabilities, except the caller specified enable
         * flags: is[Feature]Enabled.
         *
         * @param glContext the GLContext from which to initialize GL runtime capabilities.
         *
         * @throws ArgumentException if the glContext is null.
         */
        public void initialize(GLContext glContext)
        {
            if (glContext == null)
            {
                String message = Logging.getMessage("nullValue.GLContextIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            GL gl = glContext.getGL();

            if (this.glVersion < 1.0)
            {
                String s = gl.glGetString(GL.GL_VERSION);
                if (s != null)
                {
                    s = s.substring(0, 3);
                    Double d = WWUtil.convertStringToDouble(s);
                    if (d != null)
                    {
                        this.glVersion = d;
                    }
                }
            }

            // Determine whether or not the OpenGL implementation is provided by the VMware SVGA 3D driver. This flag is
            // used to work around bugs and unusual behavior in the VMware SVGA 3D driver. The VMware drivers tested on
            // 7 August 2013 report the following strings for GL_VENDOR and GL_RENDERER:
            // - GL_VENDOR: "VMware, Inc."
            // - GL_RENDERER: "Gallium 0.4 on SVGA3D; build: RELEASE;"
            String glVendor   = gl.glGetString(GL.GL_VENDOR);
            String glRenderer = gl.glGetString(GL.GL_RENDERER);

            if (glVendor != null && glVendor.toLowerCase().contains("vmware") &&
                glRenderer != null && glRenderer.toLowerCase().contains("svga3d"))
            {
                this.isVMwareSVGA3D = true;
            }

            this.isAnisotropicTextureFilterAvailable = gl.isExtensionAvailable(GL_EXT_TEXTURE_FILTER_ANISOTROPIC_STRING);
            this.isFramebufferObjectAvailable        = gl.isExtensionAvailable(GL_EXT_FRAMEBUFFER_OBJECT_STRING);
            // Vertex Buffer Objects are supported in version 1.5 or greater only.
            this.isVertexBufferObjectAvailable = this.glVersion >= 1.5;

            if (this.depthBits == 0)
            {
                int[] parameters = new int[1];
                gl.glGetIntegerv(GL.GL_DEPTH_BITS, parameters, 0);
                this.depthBits = parameters[0];
            }

            // Texture max anisotropy defaults to -1. A value less than 2.0 indicates that this graphics context does not
            // support texture anisotropy.
            if (this.maxTextureAnisotropy < 0)
            {
                // Documentation on the anisotropic texture filter is available at
                // http://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.txt
                if (this.isAnisotropicTextureFilterAvailable)
                {
                    // The maxAnisotropy value can be any real value. A value less than 2.0 indicates that the graphics
                    // context does not support texture anisotropy.
                    float[] parameters = new float[1];
                    gl.glGetFloatv(GL.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, parameters, 0);
                    this.maxTextureAnisotropy = parameters[0];
                }
            }

            if (this.numTextureUnits == 0)
            {
                int[] parameters = new int[1];
                gl.glGetIntegerv(GL2.GL_MAX_TEXTURE_UNITS, parameters, 0);
                this.numTextureUnits = parameters[0];
            }

            if (this.maxTextureSize == 0)
            {
                int[] parameters = new int[1];
                gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, parameters, 0);
                this.maxTextureSize = parameters[0];
            }
        }