public static GLTexture3D FromGeneric(STGenericTexture texture, ImageParameters parameters)
        {
            GLTexture3D glTexture = new GLTexture3D();

            glTexture.Target = TextureTarget.Texture3D;
            glTexture.Width  = (int)texture.Width;
            glTexture.Height = (int)texture.Height;
            glTexture.LoadImage(texture, parameters);
            return(glTexture);
        }
Пример #2
0
        public static GLTexture FromGenericTexture(STGenericTexture texture, ImageParameters parameters = null)
        {
            if (parameters == null)
            {
                parameters = new ImageParameters();
            }

            switch (texture.SurfaceType)
            {
            case STSurfaceType.Texture2D_Array:
                return(GLTexture2DArray.FromGeneric(texture, parameters));

            case STSurfaceType.Texture3D:
                return(GLTexture3D.FromGeneric(texture, parameters));

            case STSurfaceType.TextureCube:
                return(GLTextureCube.FromGeneric(texture, parameters));

            default:
                return(GLTexture2D.FromGeneric(texture, parameters));
            }
        }
        public static GLTexture3D CreateUncompressedTexture(int width, int height, int depth,
                                                            PixelInternalFormat format = PixelInternalFormat.Rgba8,
                                                            PixelFormat pixelFormat    = PixelFormat.Rgba,
                                                            PixelType pixelType        = PixelType.UnsignedByte)
        {
            GLTexture3D texture = new GLTexture3D();

            texture.PixelFormat = pixelFormat;
            texture.PixelType   = pixelType;
            texture.Width       = width;
            texture.Height      = height;
            texture.Depth       = depth;
            texture.Target      = TextureTarget.Texture3D;
            texture.Bind();

            GL.TexImage3D(TextureTarget.Texture3D, 0, format,
                          texture.Width, texture.Height, texture.Depth,
                          0, pixelFormat, pixelType, IntPtr.Zero);

            texture.UpdateParameters();
            texture.Unbind();
            return(texture);
        }