/// <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) { int 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.DefineExtents(_PixelFormat, _Width, 1, 1, _Level); }
/// <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) { int internalFormat = _PixelFormat.GetGlInternalFormat(); PixelFormat format = _Image.PixelLayout.GetGlFormat(); PixelType type = _Image.PixelLayout.GetPixelType(); // Set pixel transfer foreach (int alignment in new int[] { 8, 4, 2, 1 }) { if ((_Image.Stride % alignment) != 0) { continue; } Gl.PixelStore(PixelStoreParameter.UnpackAlignment, alignment); break; } // Upload texture contents Gl.TexImage1D(TextureTarget.Texture1d, (int)_Level, internalFormat, (int)_Image.Width, 0, format, type, _Image.ImageBuffer); // Define texture properties _Texture1d.DefineExtents(_PixelFormat, _Image.Width, 1, 1, _Level); }