/// <summary> /// /// </summary> public void ClearTextures() { OpenTKResources.MakeCurrentDummy(); foreach (var tex in Textures) { tex.Delete(); } Textures.Clear(); }
public void Add(byte[] rgba, int width, int height) { OpenTKResources.MakeCurrentDummy(); int texid; GL.GenTextures(1, out texid); GL.BindTexture(TextureTarget.Texture2D, texid); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, width, height, 0, PixelFormat.Bgra, PixelType.UnsignedByte, rgba); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMaxLevel, 1); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest); GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); GL.BindTexture(TextureTarget.Texture2D, 0); Textures.Add(texid); TextureSizes.Add(new Vector2(width, height)); }