static void Main() { try { string envDebug = Environment.GetEnvironmentVariable("DEBUG"); if (envDebug == "GL") { KhronosApi.Log += delegate(object sender, KhronosLogEventArgs e) { Console.WriteLine(e.ToString()); }; KhronosApi.LogEnabled = true; } // RPi runs on EGL Egl.IsRequired = true; if (Egl.IsAvailable == false) { throw new InvalidOperationException("EGL is not available. Aborting."); } using (VideoCoreWindow nativeWindow = new VideoCoreWindow()) { using (DeviceContext eglContext = DeviceContext.Create(nativeWindow.Display, nativeWindow.Handle)) { eglContext.ChoosePixelFormat(new DevicePixelFormat(32)); IntPtr glContext = eglContext.CreateContext(IntPtr.Zero); eglContext.MakeCurrent(glContext); Initialize(); Gl.Viewport(0, 0, 1920, 1080); Gl.ClearColor(0.0f, 0.0f, 0.0f, 1.0f); while (true) { Gl.Clear(ClearBufferMask.ColorBufferBit); Draw(); eglContext.SwapBuffers(); break; } System.Threading.Thread.Sleep(10000); Terminate(); eglContext.DeleteContext(glContext); } } } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }
public RaspDisplay() { try { //string envDebug = Environment.GetEnvironmentVariable("DEBUG"); //if (envDebug == "GL") //{ // Khronos.KhronosApi.Log += delegate (object sender, KhronosLogEventArgs e) // { // Console.WriteLine(e.ToString()); // }; // Khronos.KhronosApi.LogEnabled = true; //} // RPi runs on EGL Egl.IsRequired = true; if (Egl.IsAvailable == false) { throw new InvalidOperationException("EGL is not available. Aborting."); } //TODO var nativeWindow = new VideoCoreWindow(); handler = nativeWindow.Handle; //var eglContext = DeviceContext.Create(nativeWindow.Display, nativeWindow.Handle); //eglContext.ChoosePixelFormat(new DevicePixelFormat(32)); //IntPtr glContext = eglContext.CreateContext(IntPtr.Zero); //eglContext.MakeCurrent(glContext); //eglContext.DeleteContext(glContext); Console.WriteLine("nativeWindow created"); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }