Files
stgsharp/源代码/StgSharp/Graphics/Graphic.cs
T

40 lines
930 B
C#

using StgSharp.Controlling;
using System;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics
{
public static unsafe partial class Graphic
{
/// <summary>
/// Init an instance of OpenGL program,
/// This method should be called before other
/// graphic methods, after LoadGL method.
/// </summary>
public static void InitGL(int majorVersion, int minorVersion)
{
if (InternalIO.glfw_Init == null)
{
GL.glfw = new GLFWapi();
IntPtr ret;
fixed (GLFWapi* ptr = &GL.glfw)
ret = InternalIO.InternalInitGL(majorVersion, minorVersion, ptr);
InternalIO.InternalWriteLog(ret.ToString(), LogType.Info);
}
else
{
throw new Exception("Do not init GL twice");
}
}
}
}