Exemplo n.º 1
0
 public static void Bind(int textureUnit, TextureTarget target, uint textureID)
 {
     GL.ActiveTexture(TextureUnit.Texture0 + textureUnit);
     if (BindedTextures[textureUnit] == textureID) return; // on jo bindattu
     BindedTextures[textureUnit] = textureID;
     GL.BindTexture(target, textureID);
 }
Exemplo n.º 2
0
 internal void Activate(TextureTarget target, bool useMipmaps = false)
 {
   switch (this.Filter)
   {
     case TextureFilter.Linear:
       GL.TexParameter(target, TextureParameterName.TextureMinFilter, useMipmaps ? 9987 : 9729);
       GL.TexParameter(target, TextureParameterName.TextureMagFilter, 9729);
       break;
     case TextureFilter.Point:
       GL.TexParameter(target, TextureParameterName.TextureMinFilter, useMipmaps ? 9984 : 9728);
       GL.TexParameter(target, TextureParameterName.TextureMagFilter, 9728);
       break;
     case TextureFilter.Anisotropic:
       GL.TexParameter(target, TextureParameterName.TextureMinFilter, useMipmaps ? 9987 : 9729);
       GL.TexParameter(target, TextureParameterName.TextureMagFilter, 9729);
       break;
     case TextureFilter.MinLinearMagPointMipLinear:
       GL.TexParameter(target, TextureParameterName.TextureMinFilter, useMipmaps ? 9987 : 9729);
       GL.TexParameter(target, TextureParameterName.TextureMagFilter, 9728);
       break;
     default:
       throw new NotImplementedException();
   }
   GL.TexParameter(target, TextureParameterName.TextureWrapS, this.GetWrapMode(this.AddressU));
   GL.TexParameter(target, TextureParameterName.TextureWrapT, this.GetWrapMode(this.AddressV));
 }
Exemplo n.º 3
0
        public Texture( TextureTarget target )
        {
            TextureTarget = target;

            myID = -1;
            myLoaded = false;
        }
Exemplo n.º 4
0
 public void Upload(TextureTarget target, Region2D region)
 {
     GL.TexImage3D(target, 0, InternalFormat,
                     Size.Width, Size.Height, Depth,
                     0, Format, Type,
                     IntPtr.Zero);
 }
Exemplo n.º 5
0
        protected TextureBase(TextureTarget target)
        {
            Target = target;
            Name = GL.GenTexture();

            Utilities.CheckGL();
        }
Exemplo n.º 6
0
 Int32 Build1DMipmapLevel(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data)
 {
     unsafe
     {
         return Delegates.gluBuild1DMipmapLevels((TextureTarget)target, (Int32)internalFormat, (Int32)width, (PixelFormat)format, (PixelType)type, (Int32)level, (Int32)@base, (Int32)max, (IntPtr)data);
     }
 }
Exemplo n.º 7
0
 Int32 Build1DMipmap(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, IntPtr data)
 {
     unsafe
     {
         return Delegates.gluBuild1DMipmaps((TextureTarget)target, (Int32)internalFormat, (Int32)width, (PixelFormat)format, (PixelType)type, (IntPtr)data);
     }
 }
Exemplo n.º 8
0
 public static unsafe void TexImage2D( TextureTarget target, int level, int internalformat, int width, int height, int border, PixelFormat format, byte[] pixels )
 {
     fixed (byte *pix = &pixels[0])
     {
         OpenGLNative.TexImage2D( target, level, internalformat, width, height, border, format, PixelType.UnsignedByte,
                                  pix );
     }
 }
Exemplo n.º 9
0
 public GLTexture(int id, int width, int height, PixelFormatDescriptor pixelFormat, TextureTarget dimension)
 {
     Id = id;
     Width = width;
     Height = height;
     PixelFormat = pixelFormat;
     Dimension = dimension;
 }
Exemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 public void Initialize(uint unit, TextureTarget target)
 {
     if (!this.initialized)
     {
         this.DoInitialize(unit, target);
         this.initialized = true;
     }
 }
Exemplo n.º 11
0
        public void SwitchFace(TextureTarget face)
        {
            if(!Generated)
                Generate();
            GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, face, TexColor, 0);

            GL.DrawBuffer(DrawBufferMode.ColorAttachment0);
        }
Exemplo n.º 12
0
 public static unsafe void TexImage2D( TextureTarget target, int level, int internalformat, int width, int height, int border, PixelFormat format, PixelType type, byte[] pixels )
 {
     if (pixels == null) OpenGLNative.TexImage2D( target, level, internalformat, width, height, border, format, type, null );
     else fixed (byte* bytes = &pixels[0])
     {
         OpenGLNative.TexImage2D( target, level, internalformat, width, height, border, format, type, bytes );
     }
 }
Exemplo n.º 13
0
		protected TextureBase(TextureTarget target)
		{
			// set texture target
			mTextureTarget = target;

			// generate texture id
			GL.GenTextures (1, out mTextureId);
		}
Exemplo n.º 14
0
 /// <summary>
 /// Texture.
 /// </summary>
 /// <param name="target"></param>
 /// <param name="imageBuilder"></param>
 /// <param name="parameters"></param>
 /// <param name="mipmapFiltering"></param>
 public Texture(
     TextureTarget target,
     ImageFiller imageBuilder,
     SamplerParameters parameters,
     MipmapFilter mipmapFiltering = MipmapFilter.LinearMipmapLinear)
     : this(target, imageBuilder, new FakeSampler(parameters, mipmapFiltering))
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Texture.
 /// </summary>
 /// <param name="target"></param>
 /// <param name="bitmap"></param>
 /// <param name="parameters"></param>
 /// <param name="mipmapFiltering"></param>
 /// <param name="maxLevel"></param>
 /// <param name="border"></param>
 public Texture(
     TextureTarget target,
     Bitmap bitmap,
     SamplerParameters parameters,
     MipmapFilter mipmapFiltering = MipmapFilter.LinearMipmapLinear, int maxLevel = 0, int border = 0)
     : this(target, new BitmapFiller(bitmap, maxLevel, OpenGL.GL_RGBA, border, OpenGL.GL_BGRA, OpenGL.GL_UNSIGNED_BYTE, target == TextureTarget.Texture2D), new FakeSampler(parameters, mipmapFiltering))
 {
 }
Exemplo n.º 16
0
 public Texture(int id, int width, int height, TextureTarget target, PixelInternalFormat format)
 {
     Width = width;
     Height = height;
     ID = id;
     TextureTarget = target;
     PixelInternalFormat = format;
 }
Exemplo n.º 17
0
 public void SwitchCamera(TextureTarget face)
 {
     if(!Generated)
         Generate();
     var proj = FacesCameras[face].GetProjectionMatrix();
     FacesCameras[face].Transformation.SetPosition(Transformation.GetPosition());
     FacesCameras[face].SetProjectionMatrix(proj);
     Camera.Current = FacesCameras[face];
 }
Exemplo n.º 18
0
        public Texture2DGL3x(Texture2DDescription description, TextureTarget textureTarget)
        {
            if (description.Width <= 0)
            {
                throw new ArgumentOutOfRangeException("description.Width", "description.Width must be greater than zero.");
            }

            if (description.Height <= 0)
            {
                throw new ArgumentOutOfRangeException("description.Height", "description.Height must be greater than zero.");
            }

            if (description.GenerateMipmaps)
            {
                if (textureTarget == TextureTarget.TextureRectangle)
                {
                    throw new ArgumentException("description.GenerateMipmaps cannot be true for texture rectangles.", "description");
                }
                
                if (!TextureUtility.IsPowerOfTwo(Convert.ToUInt32(description.Width)))
                {
                    throw new ArgumentException("When description.GenerateMipmaps is true, the width must be a power of two.", "description");
                }

                if (!TextureUtility.IsPowerOfTwo(Convert.ToUInt32(description.Height)))
                {
                    throw new ArgumentException("When description.GenerateMipmaps is true, the height must be a power of two.", "description");
                }
            }
            
            _name = new TextureNameGL3x();
            _target = textureTarget;
            _description = description;
            _lastTextureUnit = OpenTKTextureUnit.Texture0 + (Device.NumberOfTextureUnits - 1);

            //
            // TexImage2D is just used to allocate the texture so a PBO can't be bound.
            //
            WritePixelBufferGL3x.UnBind();
            BindToLastTextureUnit();
            GL.TexImage2D(_target, 0,
                TypeConverterGL3x.To(description.TextureFormat),
                description.Width,
                description.Height,
                0,
                TypeConverterGL3x.TextureToPixelFormat(description.TextureFormat),   
                TypeConverterGL3x.TextureToPixelType(description.TextureFormat),
                new IntPtr());

            //
            // Default sampler, compatiable when attaching a non-mimapped 
            // texture to a frame buffer object.
            //
            ApplySampler(Device.TextureSamplers.LinearClamp);

            GC.AddMemoryPressure(description.ApproximateSizeInBytes);
        }
Exemplo n.º 19
0
        protected Texture(TextureTarget type, PixelInternalFormat format, OpenTK.Graphics.OpenGL.PixelFormat format2, int num) {
            ID = GL.GenTexture();

            Type = type;
            Format = format;
            Number = num;

            Activate();

        }
Exemplo n.º 20
0
        protected Texture(IOpenGL30 gl, TextureTarget target)
        {
            var newHandle = gl.GenTexture();
            if(newHandle == 0u)
                throw new NoHandleCreatedException();

            Target = target;
            this._gl = gl;
            Handle = newHandle;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Texture.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="imageBuilder"></param>
        /// <param name="samplerBuilder"></param>
        public Texture(
            TextureTarget target,
            ImageFiller imageBuilder,
            SamplerBase samplerBuilder)
        {
            if (imageBuilder == null || samplerBuilder == null) { throw new ArgumentNullException(); }

            this.Target = target;
            this.ImageFiller = imageBuilder;
            this.Sampler = samplerBuilder;
        }
Exemplo n.º 22
0
 /// <summary>
 /// texture's settings.
 /// </summary>
 /// <param name="unit">OpenGL.GL_TEXTURE0 etc.</param>
 /// <param name="target"></param>
 public override void Bind(uint unit, TextureTarget target)
 {
     /* Clamping to edges is important to prevent artifacts when scaling */
     OpenGL.TexParameteri((uint)target, OpenGL.GL_TEXTURE_WRAP_R, (int)this.parameters.wrapR);
     OpenGL.TexParameteri((uint)target, OpenGL.GL_TEXTURE_WRAP_S, (int)this.parameters.wrapS);
     OpenGL.TexParameteri((uint)target, OpenGL.GL_TEXTURE_WRAP_T, (int)this.parameters.wrapT);
     /* Linear filtering usually looks best for text */
     OpenGL.TexParameteri((uint)target, OpenGL.GL_TEXTURE_MIN_FILTER, (int)this.parameters.minFilter);
     OpenGL.TexParameteri((uint)target, OpenGL.GL_TEXTURE_MAG_FILTER, (int)this.parameters.magFilter);
     // TODO: mipmap filter not working yet.
 }
        /// <summary>
        /// Constructor to create a new Texture instance.
        /// </summary>
        /// <param name="target">Texture target type used by the texture</param>
        /// <param name="width">Width of the texture in pixels</param>
        /// <param name="height">Height of the texture in pixels</param>
        /// <param name="depth">Depth of the texture in pixels</param>
        protected Texture(TextureTarget target, int width, int height, int depth = 1)
        {
            TextureTarget = target;

            Width = width;
            Height = height;
            Depth = depth;

            _id = -1;
            _loaded = false;
        }
Exemplo n.º 24
0
		public GLTexture(string name, TextureTarget type, int width, int height)
		{
			#if ENABLE_PROFILING
			allocatedTextureCounter++;
			allocatedTextureNames.Add(this, name);
			#endif

			this.type = type;
			this.width = width;
			this.height = height;
		}
		public static void GetTexFilterFuncSGIS(TextureTarget target, Int32 filter, [Out] float[] weights)
		{
			unsafe {
				fixed (float* p_weights = weights)
				{
					Debug.Assert(Delegates.pglGetTexFilterFuncSGIS != null, "pglGetTexFilterFuncSGIS not implemented");
					Delegates.pglGetTexFilterFuncSGIS((Int32)target, filter, p_weights);
					LogFunction("glGetTexFilterFuncSGIS({0}, {1}, {2})", target, LogEnumName(filter), LogValue(weights));
				}
			}
			DebugCheckErrors(null);
		}
Exemplo n.º 26
0
        public Texture(int width, int height, TextureTarget type, PixelInternalFormat format, OpenTK.Graphics.OpenGL.PixelFormat format2, int num)
        {
            ID = GL.GenTexture();

            Type = type;
            Format = format;
            Number = num;

            Activate();

            GL.TexImage2D(Type, 0, Format, width, height, 0, format2, PixelType.UnsignedByte, IntPtr.Zero);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Creates a new managed 2D Texture with an explicitly specified format
        /// </summary>
        /// <param name="width">The width in Pixels of the Texture</param>
        /// <param name="height">The height in Pixels of the Texture</param>
        /// <param name="format">The format to use</param>
        /// <param name="target">The target this Texture will be bound to</param>
        public Texture2D(int width, int height, PixelInternalFormat format,  TextureTarget target = TextureTarget.Texture2D)
            : base(target)
        {
            _internalFormat = format;
            Activate();
            GL.TexParameter(Target, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); // GL_REPEAT
            GL.TexParameter(Target, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); // GL_REPEAT
            GL.TexParameter(Target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(Target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            Resize(width, height);
        }
Exemplo n.º 28
0
		public static void SharpenTexFuncSGIS(TextureTarget target, Int32 n, float[] points)
		{
			unsafe {
				fixed (float* p_points = points)
				{
					Debug.Assert(Delegates.pglSharpenTexFuncSGIS != null, "pglSharpenTexFuncSGIS not implemented");
					Delegates.pglSharpenTexFuncSGIS((Int32)target, n, p_points);
					CallLog("glSharpenTexFuncSGIS({0}, {1}, {2})", target, n, points);
				}
			}
			DebugCheckErrors();
		}
Exemplo n.º 29
0
		/// <summary>
		/// Creates the CL image from GL texture.  This can be a platfor specific operation.
		/// On some platforms, some of the parameters may be ignored.
		/// </summary>
		/// <returns>The CL image from GL texture.</returns>
		/// <param name="context">Context.</param>
		/// <param name="memFlags">Mem flags.</param>
		/// <param name="target">Target.</param>
		/// <param name="mipLevel">Mip level.</param>
		/// <param name="texturePointer">Texture pointer.</param>
		/// <param name="error">Error.</param>
		public static IMem CreateCLImageFromGLTexture(Context context, MemFlags memFlags, TextureTarget target, int mipLevel, IntPtr texturePointer, out ErrorCode error){
			#if UNITY_STANDALONE_OSX || UNITY_IPHONE
			//here, we use a function from apple (gcl) headers
			var ret = new Mem(gcl_gl_create_image_from_texture(target,new IntPtr(mipLevel),texturePointer));
			error = ErrorCode.Success;
			return ret;
			#endif
			#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_ANDROID
			//here we use the GL sharing extensions.
			return new Mem(clCreateFromGLTexture2D((context as IHandleData).Handle,memFlags,target,new IntPtr(mipLevel),texturePointer,out error));
			#endif
		}
Exemplo n.º 30
0
		public static void GetTexFilterFuncSGIS(TextureTarget target, Int32 filter, [Out] float[] weights)
		{
			unsafe {
				fixed (float* p_weights = weights)
				{
					Debug.Assert(Delegates.pglGetTexFilterFuncSGIS != null, "pglGetTexFilterFuncSGIS not implemented");
					Delegates.pglGetTexFilterFuncSGIS((Int32)target, filter, p_weights);
					CallLog("glGetTexFilterFuncSGIS({0}, {1}, {2})", target, filter, weights);
				}
			}
			DebugCheckErrors();
		}
Exemplo n.º 31
0
 internal static TextureTarget3d GetTextureTargetForDataSet3D(TextureTarget target)
 {
     return((TextureTarget3d)target);
 }
Exemplo n.º 32
0
 public unsafe partial void GetnCompressedTexImage([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int lod, [Flow(FlowDirection.In)] uint bufSize, [Count(Parameter = "bufSize"), Flow(FlowDirection.Out)] void *img);
Exemplo n.º 33
0
 public partial void GetnCompressedTexImage <T0>([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int lod, [Flow(FlowDirection.In)] uint bufSize, [Count(Parameter = "bufSize"), Flow(FlowDirection.Out)] out T0 img) where T0 : unmanaged;
Exemplo n.º 34
0
        private void ReadFrom2D(IntPtr data, int layer, int level, int width, int height)
        {
            TextureTarget target = Target.Convert();

            int mipSize = Info.GetMipSize2D(level);

            Bind(target, 0);

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            switch (Target)
            {
            case Target.Texture1D:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage1D(
                        target,
                        level,
                        0,
                        width,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage1D(
                        target,
                        level,
                        0,
                        width,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Texture1DArray:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage2D(
                        target,
                        level,
                        0,
                        layer,
                        width,
                        1,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage2D(
                        target,
                        level,
                        0,
                        layer,
                        width,
                        1,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Texture2D:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage2D(
                        target,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage2D(
                        target,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Texture2DArray:
            case Target.Texture3D:
            case Target.CubemapArray:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage3D(
                        target,
                        level,
                        0,
                        0,
                        layer,
                        width,
                        height,
                        1,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage3D(
                        target,
                        level,
                        0,
                        0,
                        layer,
                        width,
                        height,
                        1,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;

            case Target.Cubemap:
                if (format.IsCompressed)
                {
                    GL.CompressedTexSubImage2D(
                        TextureTarget.TextureCubeMapPositiveX + layer,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        mipSize,
                        data);
                }
                else
                {
                    GL.TexSubImage2D(
                        TextureTarget.TextureCubeMapPositiveX + layer,
                        level,
                        0,
                        0,
                        width,
                        height,
                        format.PixelFormat,
                        format.PixelType,
                        data);
                }
                break;
            }
        }
Exemplo n.º 35
0
        private void ReadFrom(IntPtr data, int size)
        {
            TextureTarget target = Target.Convert();

            Bind(target, 0);

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            int width  = Info.Width;
            int height = Info.Height;
            int depth  = Info.Depth;

            int offset = 0;

            for (int level = 0; level < Info.Levels; level++)
            {
                int mipSize = Info.GetMipSize(level);

                int endOffset = offset + mipSize;

                if ((uint)endOffset > (uint)size)
                {
                    return;
                }

                switch (Info.Target)
                {
                case Target.Texture1D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture1DArray:
                case Target.Texture2D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture2DArray:
                case Target.Texture3D:
                case Target.CubemapArray:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Cubemap:
                    int faceOffset = 0;

                    for (int face = 0; face < 6; face++, faceOffset += mipSize / 6)
                    {
                        if (format.IsCompressed)
                        {
                            GL.CompressedTexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                mipSize / 6,
                                data + faceOffset);
                        }
                        else
                        {
                            GL.TexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                format.PixelType,
                                data + faceOffset);
                        }
                    }
                    break;
                }

                data   += mipSize;
                offset += mipSize;

                width  = Math.Max(1, width >> 1);
                height = Math.Max(1, height >> 1);

                if (Target == Target.Texture3D)
                {
                    depth = Math.Max(1, depth >> 1);
                }
            }
        }
Exemplo n.º 36
0
 public unsafe partial void GetTexParameterI([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] EXT pname, [Count(Computed = "pname"), Flow(FlowDirection.Out)] uint * @params);
Exemplo n.º 37
0
 public abstract void TextureView([Flow(FlowDirection.In)] uint texture, [Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] uint origtexture, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint minlevel, [Flow(FlowDirection.In)] uint numlevels, [Flow(FlowDirection.In)] uint minlayer, [Flow(FlowDirection.In)] uint numlayers);
Exemplo n.º 38
0
 public static void FramebufferTexture2DMultisampleEXT(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, UInt32 texture, Int32 level, Int32 samples)
 {
     Debug.Assert(Delegates.pglFramebufferTexture2DMultisampleEXT != null, "pglFramebufferTexture2DMultisampleEXT not implemented");
     Delegates.pglFramebufferTexture2DMultisampleEXT((Int32)target, (Int32)attachment, (Int32)textarget, texture, level, samples);
     LogCommand("glFramebufferTexture2DMultisampleEXT", null, target, attachment, textarget, texture, level, samples);
     DebugCheckErrors(null);
 }
Exemplo n.º 39
0
 public static unsafe void GetInternalformat(this ArbInternalformatQuery2 thisApi, [Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] InternalFormatPName pname, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.Out)] Span <long> @params)
 {
     // SpanOverloader
     thisApi.GetInternalformat(target, internalformat, pname, count, out @params.GetPinnableReference());
 }
Exemplo n.º 40
0
        public void LoadOpenGLTexture(STGenericTexture GenericTexture, int ArrayStartIndex = 0, bool LoadArrayLevels = false)
        {
            if (!Runtime.OpenTKInitialized || GLInitialized || IsFailedState)
            {
                return;
            }

            width  = (int)GenericTexture.Width;
            height = (int)GenericTexture.Height;

            switch (GenericTexture.SurfaceType)
            {
            case STSurfaceType.Texture1D:
                TextureTarget = TextureTarget.Texture1D;
                break;

            case STSurfaceType.Texture2D:
                TextureTarget = TextureTarget.Texture2D;
                break;

            case STSurfaceType.Texture2D_Array:
                TextureTarget = TextureTarget.Texture2DArray;
                break;

            case STSurfaceType.Texture2D_Mulitsample:
                TextureTarget = TextureTarget.Texture2DMultisample;
                break;

            case STSurfaceType.Texture2D_Multisample_Array:
                TextureTarget = TextureTarget.Texture2DMultisampleArray;
                break;

            case STSurfaceType.Texture3D:
                TextureTarget = TextureTarget.Texture3D;
                break;

            case STSurfaceType.TextureCube:
                IsCubeMap     = true;
                TextureTarget = TextureTarget.TextureCubeMap;
                break;

            case STSurfaceType.TextureCube_Array:
                IsCubeMap     = true;
                TextureTarget = TextureTarget.TextureCubeMapArray;
                break;
            }

            if (GenericTexture.ArrayCount == 0)
            {
                GenericTexture.ArrayCount = 1;
            }

            List <STGenericTexture.Surface> Surfaces = new List <STGenericTexture.Surface>();

            try
            {
                if (UseMipmaps && GenericTexture.ArrayCount == 1)
                {
                    //Load surfaces with mip maps
                    Surfaces = GenericTexture.GetSurfaces(ArrayStartIndex, false, 6);
                }
                else
                {
                    //Only load first mip level. Will be generated after
                    for (int i = 0; i < GenericTexture.ArrayCount; i++)
                    {
                        if (i >= ArrayStartIndex && i <= ArrayStartIndex + 6) //Only load up to 6 faces
                        {
                            Surfaces.Add(new STGenericTexture.Surface()
                            {
                                mipmaps = new List <byte[]>()
                                {
                                    GenericTexture.GetImageData(i, 0)
                                }
                            });
                        }
                    }
                }

                if (Surfaces.Count == 0 || Surfaces[0].mipmaps[0].Length == 0)
                {
                    return;
                }

                IsCubeMap = Surfaces.Count == 6;
                ImageSize = Surfaces[0].mipmaps[0].Length;

                if (IsCubeMap)
                {
                    TextureTarget = TextureTarget.TextureCubeMap;
                }

                //Force RGBA and use ST for decoding for weird width/heights
                //Open GL decoder has issues with certain width/heights

                Console.WriteLine($"width pow {width} {IsPow2(width)}");
                Console.WriteLine($"height pow {height} {IsPow2(height)}");

                if (!IsPow2(width) || !IsPow2(height))
                {
                    UseOpenGLDecoder = false;
                }

                pixelInternalFormat = PixelInternalFormat.Rgba;
                pixelFormat         = OpenTK.Graphics.OpenGL.PixelFormat.Rgba;

                if (GenericTexture.Platform is Imaging.CTRSwizzle ||
                    GenericTexture.Platform is Imaging.GamecubeSwizzle ||
                    GenericTexture.Platform is Imaging.NitroSwizzle)
                {
                    UseOpenGLDecoder = false;
                    pixelFormat      = OpenTK.Graphics.OpenGL.PixelFormat.Bgra;
                }

                if (UseOpenGLDecoder)
                {
                    SetPixelFormats(GenericTexture.Platform.OutputFormat);
                }

                GLInitialized = true;
                for (int i = 0; i < Surfaces.Count; i++)
                {
                    for (int MipLevel = 0; MipLevel < Surfaces[i].mipmaps.Count; MipLevel++)
                    {
                        uint width  = Math.Max(1, GenericTexture.Width >> MipLevel);
                        uint height = Math.Max(1, GenericTexture.Height >> MipLevel);

                        if (!UseOpenGLDecoder)
                        {
                            Surfaces[i].mipmaps[MipLevel] = TryDecodeSurface(Surfaces[i].mipmaps[MipLevel], width, height, GenericTexture);
                        }
                    }
                }

                TexID = GenerateOpenGLTexture(this, Surfaces);

                if (IsCubeMap)
                {
                    TextureWrapS     = TextureWrapMode.Clamp;
                    TextureWrapT     = TextureWrapMode.Clamp;
                    TextureWrapR     = TextureWrapMode.Clamp;
                    TextureMinFilter = TextureMinFilter.LinearMipmapLinear;
                    TextureMagFilter = TextureMagFilter.Linear;
                }

                Surfaces.Clear();
            }
            catch
            {
                IsFailedState = true;
                GLInitialized = false;
                return;
            }
        }
Exemplo n.º 41
0
 public unsafe static void GetnTexImage(TextureTarget target, int level, PixelFormat format, PixelType type, int bufSize, IntPtr pixels)
 => glGetnTexImage(target, level, format, type, bufSize, pixels);
Exemplo n.º 42
0
        /// <summary>
        /// Loads a compressed DDS file into an OpenGL texture.
        /// </summary>
        /// <param name="ResourceFile">The path to the DDS file.</param>
        private void LoadDDS(string ResourceFile)
        {
            using (BinaryReader stream = new BinaryReader(new FileStream(ResourceFile, FileMode.Open)))
            {
                string filecode = new string(stream.ReadChars(4));
                if (filecode != "DDS ")                                 // first 4 chars should be "DDS "
                {
                    throw new Exception("File was not a DDS file format.");
                }

                DDS.DDSURFACEDESC2 imageData = DDS.DDSURFACEDESC2.FromBinaryReader(stream);//new DDS.DDSURFACEDESC2(stream);  // read the DirectDraw surface descriptor
                this.Size = new Size((int)imageData.Width, (int)imageData.Height);

                if (imageData.LinearSize == 0)
                {
                    throw new Exception("The linear scan line size was zero.");
                }

                bool compressed = true;
                int  factor = 0, buffersize = 0, blocksize = 0;
                PixelInternalFormat format;
                switch (imageData.PixelFormat.FourCC) // check the compression type
                {
                case "DXT1":                          // DXT1 compression ratio is 8:1
                    format    = PixelInternalFormat.CompressedRgbaS3tcDxt1Ext;
                    factor    = 2;
                    blocksize = 8;
                    break;

                case "DXT3":        // DXT3 compression ratio is 4:1
                    format    = PixelInternalFormat.CompressedRgbaS3tcDxt3Ext;
                    factor    = 4;
                    blocksize = 16;
                    break;

                case "DXT5":        // DXT5 compression ratio is 4:1
                    format    = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
                    factor    = 4;
                    blocksize = 16;
                    break;

                default:
                    compressed = false;
                    if (imageData.PixelFormat.ABitMask == 0xf000 && imageData.PixelFormat.RBitMask == 0x0f00 &&
                        imageData.PixelFormat.GBitMask == 0x00f0 && imageData.PixelFormat.BBitMask == 0x000f &&
                        imageData.PixelFormat.RGBBitCount == 16)
                    {
                        format = PixelInternalFormat.Rgba;
                    }
                    else if (imageData.PixelFormat.ABitMask == unchecked ((int)0xff000000) && imageData.PixelFormat.RBitMask == 0x00ff0000 &&
                             imageData.PixelFormat.GBitMask == 0x0000ff00 && imageData.PixelFormat.BBitMask == 0x000000ff &&
                             imageData.PixelFormat.RGBBitCount == 32)
                    {
                        format = PixelInternalFormat.Rgba;
                    }
                    else
                    {
                        throw new Exception(string.Format("File compression \"{0}\" is not supported.", imageData.PixelFormat.FourCC));
                    }
                    break;
                }

                if (imageData.LinearSize != 0)
                {
                    buffersize = (int)((imageData.MipmapCount > 1) ? imageData.LinearSize * factor : imageData.LinearSize);
                }
                else
                {
                    buffersize = (int)(stream.BaseStream.Length - stream.BaseStream.Position);
                }

                // read the pixel data and then pin it to memory so that the garbage collector
                // doesn't shuffle the data around while OpenGL is decompressing it
                byte[]   pixels = stream.ReadBytes(buffersize);
                GCHandle pinned = GCHandle.Alloc(pixels, GCHandleType.Pinned);

                try
                {
                    TextureTarget = (imageData.Height == 1 || imageData.Width == 1) ? TextureTarget.Texture1D : TextureTarget.Texture2D;
                    TextureID     = Gl.GenTexture();

                    Gl.BindTexture(TextureTarget, TextureID);
                    Gl.TexParameteri(TextureTarget, TextureParameterName.TextureMinFilter, TextureParameter.Linear);
                    Gl.TexParameteri(TextureTarget, TextureParameterName.TextureMagFilter, TextureParameter.Linear);

                    int nOffset = 0, nWidth = (int)imageData.Width, nHeight = (int)imageData.Height;

                    for (int i = 0; i < (imageData.MipmapCount == 0 ? 1 : imageData.MipmapCount); ++i)
                    {
                        if (nWidth == 0)
                        {
                            nWidth = 1;                     // smallest mipmap is 1x1 pixels
                        }
                        if (nHeight == 0)
                        {
                            nHeight = 1;
                        }
                        int nSize = 0;

                        if (compressed)
                        {
                            nSize = ((nWidth + 3) / 4) * ((nHeight + 3) / 4) * blocksize;
                            Gl.CompressedTexImage2D(TextureTarget, i, format, nWidth, nHeight, 0, nSize, (IntPtr)(pinned.AddrOfPinnedObject().ToInt64() + nOffset));
                        }
                        else
                        {
                            PixelType pixelType = imageData.PixelFormat.RGBBitCount == 16 ? PixelType.UnsignedShort4444Reversed : PixelType.UnsignedInt8888Reversed;

                            nSize = nWidth * nHeight * imageData.PixelFormat.RGBBitCount / 8;
                            Gl.TexImage2D(TextureTarget, i, format, nWidth, nHeight, 0, PixelFormat.Bgra, pixelType, (IntPtr)(pinned.AddrOfPinnedObject().ToInt64() + nOffset));
                        }

                        nOffset += nSize;
                        nWidth  /= 2;
                        nHeight /= 2;
                    }

#if MEMORY_LOGGER
                    MemoryLogger.AllocateTexture(TextureID, Size);
#endif
                }
                catch (Exception)
                {   // There was some sort of Dll related error, or the target GPU does not support glCompressedTexImage2DARB
                    throw;
                }
                finally
                {
                    pinned.Free();
                }
            }
        }
Exemplo n.º 43
0
        internal void Apply(bool hasMipmap, SamplerState oldSamplerState, TextureTarget target)
        {
            if (Description.MinMipLevel != oldSamplerState.Description.MinMipLevel)
            {
                GL.TexParameter(target, TextureParameterName.TextureMinLod, Description.MinMipLevel);
            }
            if (Description.MaxMipLevel != oldSamplerState.Description.MaxMipLevel)
            {
                GL.TexParameter(target, TextureParameterName.TextureMaxLod, Description.MaxMipLevel);
            }
            if (textureWrapR != oldSamplerState.textureWrapR)
            {
                GL.TexParameter(target, TextureParameterName.TextureWrapR, (int)textureWrapR);
            }
            if (compareMode != oldSamplerState.compareMode)
            {
                GL.TexParameter(target, TextureParameterName.TextureCompareMode, (int)compareMode);
            }
            if (compareFunc != oldSamplerState.compareFunc)
            {
                GL.TexParameter(target, TextureParameterName.TextureCompareFunc, (int)compareFunc);
            }

#if !XENKO_GRAPHICS_API_OPENGLES
            if (borderColor != oldSamplerState.borderColor)
            {
                GL.TexParameter(target, TextureParameterName.TextureBorderColor, borderColor);
            }
            if (Description.MipMapLevelOfDetailBias != oldSamplerState.Description.MipMapLevelOfDetailBias)
            {
                GL.TexParameter(target, TextureParameterName.TextureLodBias, Description.MipMapLevelOfDetailBias);
            }
            if (minFilter != oldSamplerState.minFilter)
            {
                GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)minFilter);
            }
#else
            // On OpenGL ES, we need to choose the appropriate min filter ourself if the texture doesn't contain mipmaps (done at PreDraw)
            if (minFilter != oldSamplerState.minFilter)
            {
                GL.TexParameter(target, TextureParameterName.TextureMinFilter, hasMipmap ? (int)minFilter : (int)minFilterNoMipmap);
            }
#endif

#if !XENKO_PLATFORM_IOS
            if (maxAnisotropy != oldSamplerState.maxAnisotropy && GraphicsDevice.HasAnisotropicFiltering)
            {
                GL.TexParameter(target, (TextureParameterName)OpenTK.Graphics.ES20.ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, Description.MaxAnisotropy);
            }
#endif
            if (magFilter != oldSamplerState.magFilter)
            {
                GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)magFilter);
            }
            if (textureWrapS != oldSamplerState.textureWrapS)
            {
                GL.TexParameter(target, TextureParameterName.TextureWrapS, (int)textureWrapS);
            }
            if (textureWrapT != oldSamplerState.textureWrapT)
            {
                GL.TexParameter(target, TextureParameterName.TextureWrapT, (int)textureWrapT);
            }
        }
Exemplo n.º 44
0
 public unsafe static void GetnCompressedTexImage(TextureTarget target, int lod, int bufSize, IntPtr pixels)
 => glGetnCompressedTexImage(target, lod, bufSize, pixels);
Exemplo n.º 45
0
 /// <summary>
 /// Set a scalar texture parameter.
 /// </summary>
 /// <param name="target">Specificies the target for which the texture is bound.</param>
 /// <param name="pname">Specifies the name of a single-values texture parameter.</param>
 /// <param name="param">Specifies the value of pname.</param>
 public static void TexParameteri(TextureTarget target, TextureParameterName pname, TextureParameter param)
 {
     TexParameteri(target, pname, (int)param);
 }
Exemplo n.º 46
0
 public static uint CreateTexture(TextureTarget target)
 {
     uint[] textures = new uint[1];
     glCreateTextures(target, 1, textures);
     return(textures[0]);
 }
Exemplo n.º 47
0
 public partial void GetTexParameterI([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] GetTextureParameter pname, [Count(Computed = "pname"), Flow(FlowDirection.Out)] out uint @params);
 public static unsafe void CompressedTexSubImage1D <T0>(this ArbTextureCompression thisApi, [Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] int xoffset, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] InternalFormat format, [Flow(FlowDirection.In)] uint imageSize, [Count(Parameter = "imageSize"), Flow(FlowDirection.In)] ReadOnlySpan <T0> data) where T0 : unmanaged
 {
     // SpanOverloader
     thisApi.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, in data.GetPinnableReference());
 }
Exemplo n.º 49
0
 public void FramebufferTexture2D(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget face, int level)
 {
     GL.FramebufferTexture2D(
         target,
         attachment,
         face,
         textureObject,
         level
         );
 }
Exemplo n.º 50
0
 public abstract void TexStorage3D([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] uint levels, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] uint width, [Flow(FlowDirection.In)] uint height, [Flow(FlowDirection.In)] uint depth);
Exemplo n.º 51
0
 public unsafe static void GetTextureLevelParameter(TextureTarget texture, int level, uint pName, ref int parameters)
 => glGetTextureLevelParameteriv(texture, level, pName, ref parameters);
Exemplo n.º 52
0
        private void ReadFrom(IntPtr data, int size)
        {
            TextureTarget target    = Target.Convert();
            int           baseLevel = 0;

            // glTexSubImage on cubemap views is broken on Intel, we have to use the storage instead.
            if (Target == Target.Cubemap && HwCapabilities.Vendor == HwCapabilities.GpuVendor.IntelWindows)
            {
                GL.ActiveTexture(TextureUnit.Texture0);
                GL.BindTexture(target, Storage.Handle);
                baseLevel = FirstLevel;
            }
            else
            {
                Bind(target, 0);
            }

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            int width  = Info.Width;
            int height = Info.Height;
            int depth  = Info.Depth;

            int offset = 0;

            for (int level = 0; level < Info.Levels; level++)
            {
                int mipSize = Info.GetMipSize(level);

                int endOffset = offset + mipSize;

                if ((uint)endOffset > (uint)size)
                {
                    return;
                }

                switch (Target)
                {
                case Target.Texture1D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage1D(
                            target,
                            level,
                            0,
                            width,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture1DArray:
                case Target.Texture2D:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage2D(
                            target,
                            level,
                            0,
                            0,
                            width,
                            height,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Texture2DArray:
                case Target.Texture3D:
                case Target.CubemapArray:
                    if (format.IsCompressed)
                    {
                        GL.CompressedTexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            mipSize,
                            data);
                    }
                    else
                    {
                        GL.TexSubImage3D(
                            target,
                            level,
                            0,
                            0,
                            0,
                            width,
                            height,
                            depth,
                            format.PixelFormat,
                            format.PixelType,
                            data);
                    }
                    break;

                case Target.Cubemap:
                    int faceOffset = 0;

                    for (int face = 0; face < 6; face++, faceOffset += mipSize / 6)
                    {
                        if (format.IsCompressed)
                        {
                            GL.CompressedTexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                baseLevel + level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                mipSize / 6,
                                data + faceOffset);
                        }
                        else
                        {
                            GL.TexSubImage2D(
                                TextureTarget.TextureCubeMapPositiveX + face,
                                baseLevel + level,
                                0,
                                0,
                                width,
                                height,
                                format.PixelFormat,
                                format.PixelType,
                                data + faceOffset);
                        }
                    }
                    break;
                }

                data   += mipSize;
                offset += mipSize;

                width  = Math.Max(1, width >> 1);
                height = Math.Max(1, height >> 1);

                if (Target == Target.Texture3D)
                {
                    depth = Math.Max(1, depth >> 1);
                }
            }
        }
Exemplo n.º 53
0
 public abstract unsafe void GetInternalformat([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] InternalFormat internalformat, [Flow(FlowDirection.In)] InternalFormatPName pname, [Flow(FlowDirection.In)] uint count, [Count(Parameter = "count"), Flow(FlowDirection.Out)] int * @params);
Exemplo n.º 54
0
 public unsafe static void CreateTextures(TextureTarget target, uint n, IntPtr textures)
 => glCreateTextures(target, n, textures);
Exemplo n.º 55
0
 public unsafe partial void GetnTexImage([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Flow(FlowDirection.In)] uint bufSize, [Count(Parameter = "bufSize"), Flow(FlowDirection.Out)] void *img);
Exemplo n.º 56
0
 public static void FramebufferTextureFaceARB(FramebufferTarget target, FramebufferAttachment attachment, uint texture, int level, TextureTarget face)
 {
     Debug.Assert(Delegates.pglFramebufferTextureFaceARB != null, "pglFramebufferTextureFaceARB not implemented");
     Delegates.pglFramebufferTextureFaceARB((int)target, (int)attachment, texture, level, (int)face);
     LogCommand("glFramebufferTextureFaceARB", null, target, attachment, texture, level, face);
     DebugCheckErrors(null);
 }
Exemplo n.º 57
0
 public partial void TexBufferRange([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] SizedInternalFormat internalformat, [Flow(FlowDirection.In)] uint buffer, [Flow(FlowDirection.In)] nint offset, [Flow(FlowDirection.In)] nuint size);
Exemplo n.º 58
0
 public partial void GetnTexImage <T0>([Flow(FlowDirection.In)] TextureTarget target, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] PixelFormat format, [Flow(FlowDirection.In)] PixelType type, [Flow(FlowDirection.In)] uint bufSize, [Count(Parameter = "bufSize"), Flow(FlowDirection.Out)] out T0 img) where T0 : unmanaged;
Exemplo n.º 59
0
        private void CreateView()
        {
            TextureTarget target = Target.Convert();

            FormatInfo format = FormatTable.GetFormatInfo(Info.Format);

            PixelInternalFormat pixelInternalFormat;

            if (format.IsCompressed)
            {
                pixelInternalFormat = (PixelInternalFormat)format.PixelFormat;
            }
            else
            {
                pixelInternalFormat = format.PixelInternalFormat;
            }

            int levels = Info.GetLevelsClamped();

            GL.TextureView(
                Handle,
                target,
                _parent.Handle,
                pixelInternalFormat,
                FirstLevel,
                levels,
                FirstLayer,
                Info.GetLayers());

            GL.ActiveTexture(TextureUnit.Texture0);

            GL.BindTexture(target, Handle);

            int[] swizzleRgba = new int[]
            {
                (int)Info.SwizzleR.Convert(),
                (int)Info.SwizzleG.Convert(),
                (int)Info.SwizzleB.Convert(),
                (int)Info.SwizzleA.Convert()
            };

            if (Info.Format == Format.A1B5G5R5Unorm)
            {
                int temp  = swizzleRgba[0];
                int temp2 = swizzleRgba[1];
                swizzleRgba[0] = swizzleRgba[3];
                swizzleRgba[1] = swizzleRgba[2];
                swizzleRgba[2] = temp2;
                swizzleRgba[3] = temp;
            }
            else if (Info.Format.IsBgr())
            {
                // Swap B <-> R for BGRA formats, as OpenGL has no support for them
                // and we need to manually swap the components on read/write on the GPU.
                int temp = swizzleRgba[0];
                swizzleRgba[0] = swizzleRgba[2];
                swizzleRgba[2] = temp;
            }

            GL.TexParameter(target, TextureParameterName.TextureSwizzleRgba, swizzleRgba);

            int maxLevel = levels - 1;

            if (maxLevel < 0)
            {
                maxLevel = 0;
            }

            GL.TexParameter(target, TextureParameterName.TextureMaxLevel, maxLevel);
            GL.TexParameter(target, TextureParameterName.DepthStencilTextureMode, (int)Info.DepthStencilMode.Convert());
        }
Exemplo n.º 60
0
 public abstract void FramebufferTexture2DMultisample([Flow(FlowDirection.In)] FramebufferTarget target, [Flow(FlowDirection.In)] FramebufferAttachment attachment, [Flow(FlowDirection.In)] TextureTarget textarget, [Flow(FlowDirection.In)] uint texture, [Flow(FlowDirection.In)] int level, [Flow(FlowDirection.In)] uint samples);