Beispiel #1
0
 internal void BindTexture(glTexture Texture, glTexture.BindTarget Target)
 {
     lock (_TextureUnitTrackers)
     {
         _ActiveTextureUnit.BindTexture(Texture, Target);
     }
 }
Beispiel #2
0
        internal static int GlTargetTotextureTargetIndex(glTexture.BindTarget Target)
        {
            switch (Target)
            {
            case glTexture.BindTarget.GL_TEXTURE_1D: return(0);

            case glTexture.BindTarget.GL_TEXTURE_1D_ARRAY: return(1);

            case glTexture.BindTarget.GL_TEXTURE_2D: return(2);

            case glTexture.BindTarget.GL_TEXTURE_2D_ARRAY: return(3);

            case glTexture.BindTarget.GL_TEXTURE_2D_MULTISAMPLE: return(4);

            case glTexture.BindTarget.GL_TEXTURE_2D_MULTISAMPLE_ARRAY: return(5);

            case glTexture.BindTarget.GL_TEXTURE_3D: return(6);

            case glTexture.BindTarget.GL_TEXTURE_BUFFER: return(7);

            case glTexture.BindTarget.GL_TEXTURE_CUBE_MAP: return(8);

            case glTexture.BindTarget.GL_TEXTURE_CUBE_MAP_ARRAY: return(9);

            case glTexture.BindTarget.GL_TEXTURE_RECTANGLE: return(10);
            }
            return(0);
        }
Beispiel #3
0
        internal void TexParameter(glTexture Texture, glTexture.BindTarget Target, int Parameter, int Value)
        {
            int indexTarget = GlTargetTotextureTargetIndex(Target);

            lock (_TextureUnitTrackers)
            {
                if (_ActiveTextureUnit._Textures[indexTarget] != Texture)
                {
                    throw new Exception("The texture is not bound correctly");
                }
                _glTexParameteri((int)Target, Parameter, Value);
            }
        }
Beispiel #4
0
        internal void TexImage2D(glTexture Texture, glTexture.BindTarget Target, int Level, glTexture.InternalFormat InternalFormat, int Width, int Height, glTexture.Format Format, glTexture.Type Type, IntPtr Data)
        {
            int indexTarget = GlTargetTotextureTargetIndex(Target);

            lock (_TextureUnitTrackers)
            {
                if (_ActiveTextureUnit._Textures[indexTarget] != Texture)
                {
                    throw new Exception("The texture is not bound correctly");
                }
                _glTexImage2D((int)Target, Level, (int)InternalFormat, Width, Height, 0, (int)Format, (int)Type, Data);
            }
        }
Beispiel #5
0
            internal void BindTexture(glTexture Texture, glTexture.BindTarget Target)
            {
                int indexTarget = GlTargetTotextureTargetIndex(Target);

                lock (_Textures)
                {
                    if (Texture == null)
                    {
                        _Context._glBindTexture((int)Target, 0);
                        _Textures[indexTarget] = null;
                    }
                    else
                    {
                        _Context._glBindTexture((int)Target, Texture.Handle);
                        _Textures[indexTarget] = Texture;
                    }
                }
            }