Esempio n. 1
0
        public GL46Texture(int width, int height, Filter filter, TextureAddressMode textureAddressMode, ref float[] pixelData)
        {
            OpenTK.Graphics.OpenGL4.GL.CreateTextures(TextureTarget.Texture2D, 1, out _nativeTexture);
            OpenTK.Graphics.OpenGL4.GL.TextureStorage2D(_nativeTexture, 1, SizedInternalFormat.Rgba32f, width, height);

            OpenTK.Graphics.OpenGL4.GL.TextureParameter(_nativeTexture, TextureParameterName.TextureMinFilter, (int)filter.MinFilterToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TextureParameter(_nativeTexture, TextureParameterName.TextureMagFilter, (int)filter.MagFilterToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TextureParameter(_nativeTexture, TextureParameterName.TextureWrapR, (int)textureAddressMode.ToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TextureParameter(_nativeTexture, TextureParameterName.TextureWrapS, (int)textureAddressMode.ToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TextureParameter(_nativeTexture, TextureParameterName.TextureWrapT, (int)textureAddressMode.ToOpenTK());

            OpenTK.Graphics.OpenGL4.GL.TextureSubImage2D(_nativeTexture, 0, 0, 0, width, height, PixelFormat.Rgba, PixelType.Float, pixelData);

            View = new GL46TextureView(this);
        }
Esempio n. 2
0
        public GL33Texture(int width, int height, Filter filter, TextureAddressMode textureAddressMode, ref float[] pixelData)
        {
            _width         = width;
            _height        = height;
            _nativeTexture = OpenTK.Graphics.OpenGL4.GL.GenTexture();
            OpenTK.Graphics.OpenGL4.GL.BindTexture(TextureTarget.Texture2D, _nativeTexture);
            OpenTK.Graphics.OpenGL4.GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)filter.MinFilterToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)filter.MagFilterToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapR, (int)textureAddressMode.ToOpenTK());
            OpenTK.Graphics.OpenGL4.GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)textureAddressMode.ToOpenTK());

            OpenTK.Graphics.OpenGL4.GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, _width, _height, 0, PixelFormat.Rgba, PixelType.Float, pixelData);

            View = new GL33TextureView(this);
        }