Esempio n. 1
0
        public static void CheckGlError()
        {
            var code = (ErrorCode)OpenGLNative.glGetError();

            if (code != ErrorCode.NoError)
            {
                PoolTouhou.Logger.Log(
                    $"GL HAS ERROR:{code}{Environment.NewLine}{new StackTrace(1, true)}",
                    LogLevel.ERROR
                    );
            }
        }
Esempio n. 2
0
 private void DrawLoop()
 {
     PoolTouhou.Logger.Log("开始渲染线程循环");
     try {
         long last = 0;
         while (window.Exists && running)
         {
             long   now   = Watch.ElapsedTicks;
             double delta = Stopwatch.Frequency / (double)(now - last);
             OpenGLNative.glClearColor(0, 1, 1, 0.5f);
             OpenGLNative.glClear(ClearBufferMask.ColorBufferBit);
             PoolTouhou.GameState.Draw(delta);
             Sdl2Native.SDL_GL_SwapWindow(window.SdlWindowHandle);
             GlUtil.CheckGlError();
             last = now;
         }
     } catch (Exception e) {
         running = false;
         PoolTouhou.Logger.Log(e.Message + Environment.NewLine + e.StackTrace);
     }
 }