internal void CreateTextTextures (CreateTextBitmapData createData) { string[] texts = { " ", "O", "p", "e", "n", "G", "L", "E", "S", "3", ".", "0" }; texturesId = GL.GenTexture (); GL.BindTexture (TextureTarget.Texture2DArray, texturesId); GL.TexImage3D (TextureTarget3D.Texture2DArray, 0, TextureComponentCount.Rgba, 256, 256, texts.Length, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero); // setup texture parameters GL.TexParameter (TextureTarget.Texture2DArray, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); GL.TexParameter (TextureTarget.Texture2DArray, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexParameter (TextureTarget.Texture2DArray, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); GL.TexParameter (TextureTarget.Texture2DArray, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); for (int i = 0; i < texts.Length; i++) { byte[] bitmapData; int width, height; createData (texts [i], out bitmapData, out width, out height); GL.TexSubImage3D (TextureTarget3D.Texture2DArray, 0, 0, 0, i, width, height, 1, PixelFormat.Rgba, PixelType.UnsignedByte, bitmapData); GL.GenerateMipmap (TextureTarget.Texture2DArray); } }
internal void CreateTextTextures(CreateTextBitmapData createData) { string[] texts = { " ", "O", "p", "e", "n", "G", "L", "E", "S", "3", ".", "0" }; texturesId = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2DArray, texturesId); GL.TexImage3D(TextureTarget3D.Texture2DArray, 0, TextureComponentCount.Rgba, 256, 256, texts.Length, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero); // setup texture parameters GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); for (int i = 0; i < texts.Length; i++) { byte[] bitmapData; int width, height; createData(texts [i], out bitmapData, out width, out height); GL.TexSubImage3D(TextureTarget3D.Texture2DArray, 0, 0, 0, i, width, height, 1, PixelFormat.Rgba, PixelType.UnsignedByte, bitmapData); GL.GenerateMipmap(TextureTarget.Texture2DArray); } }