/// <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(); // 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.SetMipmap(_PixelFormat, _Size, _Size, 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(); PixelType type = _PixelFormat.GetPixelType(); for (int i = 0; i < 6; i++) { Image image = _Images[i]; // Set pixel alignment State.PixelAlignmentState.Unpack(image.Stride).Apply(ctx, null); // Upload texture contents Gl.TexImage2D(_CubeTargets[i], 0, internalFormat, (int)image.Width, (int)image.Height, 0, format, type, image.ImageBuffer); } // Define texture properties _TextureCube.SetMipmap(_PixelFormat, _Images[0].Width, _Images[0].Height, 1, 0); }