コード例 #1
0
        int CreateTexture(int width, int height)
        {
            int id = GL.GenTexture();

            if (id == 0)
            {
                throw new GraphicsResourceException(String.Format("Texture creation failed, (Error: {0})", GL.GetError()));
            }

            SetDefaultTextureParameters(id);

            GL.TexImage2D(TextureTarget.Texture2D, 0, InternalFormat, Width, Height, 0,
                          OpenTK.Graphics.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);

            return(id);
        }