/// <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(); PixelType type = _PixelFormat.GetPixelType(); for (int i = 0; i < 6; i++) { Image image = _Images[i]; // 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.TexImage2D(_CubeTargets[i], 0, internalFormat, (int)image.Width, (int)image.Height, 0, format, type, image.ImageBuffer); } // Define texture properties _TextureCube.DefineExtents(_PixelFormat, _Images[0].Width, _Images[0].Height, 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) { int internalFormat = _PixelFormat.GetGlInternalFormat(); // Define empty texture for (int i = 0; i < 6; i++) { Gl.TexImage2D(_CubeTargets[i], 0, internalFormat, (int)_Size, (int)_Size, 0, /* Unused */ PixelFormat.Rgb, /* Unused */ PixelType.UnsignedByte, null); } // Define texture properties _TextureCube.DefineExtents(_PixelFormat, _Size, _Size, 1, 0); }