示例#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.ToInternalFormat();
                PixelFormat    format         = _PixelFormat.ToDataFormat();

                // 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.ToInternalFormat();
                PixelFormat    format         = _Image.PixelLayout.ToDataFormat();
                PixelType      type           = _Image.PixelLayout.ToPixelType();

                // 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);
            }