示例#1
0
            /// <summary>
            /// Create the texture, using this technique.
            /// </summary>
            /// <param name="ctx">
            /// A <see cref="GraphicsContext"/> used for allocating resources.
            /// </param>
            public override void Create(GraphicsContext ctx)
            {
                InternalFormat internalFormat = _PixelFormat.GetGlInternalFormat();
                PixelFormat    format         = _PixelFormat.GetGlFormat();

                // Define empty texture
                Gl.TexImage1D(TextureTarget.Texture1d, (int)_Level, internalFormat, (int)_Width, 0, format, /* Unused */ PixelType.UnsignedByte, IntPtr.Zero);
                // Define texture properties
                _Texture1d.SetMipmap(_PixelFormat, _Width, 1, 1, _Level);
            }
示例#2
0
            /// <summary>
            /// Create the texture, using this technique.
            /// </summary>
            /// <param name="ctx">
            /// A <see cref="GraphicsContext"/> used for allocating resources.
            /// </param>
            public override void Create(GraphicsContext ctx)
            {
                InternalFormat internalFormat = _PixelFormat.GetGlInternalFormat();
                PixelFormat    format         = _Image.PixelLayout.GetGlFormat();
                PixelType      type           = _Image.PixelLayout.GetPixelType();

                // Set pixel alignment
                State.PixelAlignmentState.Unpack(_Image.Stride).Apply(ctx, null);

                // Upload texture contents
                Gl.TexImage1D(TextureTarget.Texture1d, (int)_Level, internalFormat, (int)_Image.Width, 0, format, type, _Image.ImageBuffer);
                // Define texture properties
                _Texture1d.SetMipmap(_PixelFormat, _Image.Width, 1, 1, _Level);
            }