static void RenderThread(Sample sample) { // initialize the renderer Bgfx.Init(); Bgfx.Reset(sample.WindowWidth, sample.WindowHeight, ResetFlags.Vsync); // enable debug text Bgfx.SetDebugFeatures(DebugFeatures.DisplayText); // set view 0 clear state Bgfx.SetViewClear(0, ClearTargets.Color | ClearTargets.Depth, 0x303030ff); // main loop while (sample.ProcessEvents(ResetFlags.Vsync)) { // set view 0 viewport Bgfx.SetViewRect(0, 0, 0, sample.WindowWidth, sample.WindowHeight); // make sure view 0 is cleared if no other draw calls are submitted Bgfx.Touch(0); // write some debug text Bgfx.DebugTextClear(); Bgfx.DebugTextImage( Math.Max(sample.WindowWidth / 2 / 8, 20) - 20, Math.Max(sample.WindowHeight / 2 / 16, 6) - 6, 40, 12, Logo.Bytes, 160 ); Bgfx.DebugTextWrite(0, 1, DebugColor.White, DebugColor.Blue, "SharpBgfx/Samples/00-HelloWorld"); Bgfx.DebugTextWrite(0, 2, DebugColor.White, DebugColor.Cyan, "Description: Initialization and debug text."); // advance to the next frame. Rendering thread will be kicked to // process submitted rendering primitives. Bgfx.Frame(); } // clean up Bgfx.Shutdown(); }