internal static void TexImage2D(GraphicsLibrary gl, RasterImage image, TextureTarget2D target, int level) { TexturePixelFormat textureFormat; PixelFormat format; if (image.Format == RasterImageFormat.TrueColor) { textureFormat = TexturePixelFormat.Rgb8; format = PixelFormat.Rgb; } else { textureFormat = TexturePixelFormat.Rgba8; format = PixelFormat.Rgba; } unsafe { fixed(byte *p = image.Data) { var(width, height) = image.Size; gl.TexImage2D(target, level, textureFormat, width, height, 0, format, PixelType.UnsignedByte, new IntPtr(p)); } } }
public unsafe static void TexStorage2D(TextureTarget2D target, int levels, uint internalFormat, int width, int height) => glTexStorage2D(target, levels, internalFormat, width, height);