Exemplo n.º 1
0
        /// <summary>
        /// Enables or binds a texture with a parameter and a texture ID</summary>
        /// <param name="parameter">Name of parameter used in the Cg program, usually a Simpler2D</param>
        /// <param name="texture_id">Texture ID from glTexGen()</param>
        /// <returns>True if texture enabled successfully</returns>
        public static bool EnableTexture(string parameter, int texture_id)
        {
            IntPtr param;

            try {
                m_cg_parameters.TryGetValue(parameter, out param);
                if (param == (IntPtr)0)
                {
                    return(false);
                }
                CgGl.cgGLSetTextureParameter(param, texture_id);
                CgGl.cgGLEnableTextureParameter(param);
            }
            catch { }
            return(false);
        }