//using StgSharp.Environment.Win32; using StgSharp.Controlling.UsrActivity; using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Logic; using StgSharp.Math; using System; using System.Runtime.CompilerServices; namespace StgSharp { public class StgSharpDemoForm : ViewModelBase { public StgSharpDemoForm(int frameSpeed) : base(frameSpeed) { } public StgSharpDemoForm(ViewPort vp, int frameSpeed) : base(vp, frameSpeed) { } protected sealed override void BuildGlobalKeyControl() { GlobalKeyAction.Add( new KeyTrigger(KeyboardKey.ESCAPE,KeyStatus.PRESS), new Action(() => { InternalIO.glfwSetWindowShouldClose(this.WindowID, 1); })); } } internal static class Program { internal static unsafe void Main(string[] args) { try { //StgSharp.TryCreatWindow(); /**/ StgSharp.Init(); StgSharp.InitGL(4, 6); StgSharp.GlobalSetting.VSyncActivated = false; ViewPort viewport = new ViewPort( name: "Hello, Stg#!", size: (800,800), monitor: IntPtr.Zero ); StgSharpDemoForm demoForm = new StgSharpDemoForm(vp: viewport,60); View v = demoForm.BuildNewView(null, (1,1,1)); var stream = demoForm.BuildRenderStream // // (v); var rstream = RenderStream.ShareContextWith (stream); Blueprint blueprint = new Blueprint(); BlueprintNode node0 = new BlueprintNode("BufferGenerateStream", rstream); BlueprintNode node1 = new BlueprintNode("MainRenderStream",stream); node0.AddAfter(blueprint.BeginLayer, "input_1", "input_1"); node0.AddBefore(node1, "output_1", "TextureInput"); node1.AddBefore(blueprint.EndLayer, "Output", "output_1"); blueprint.AddNativeNode(node0); blueprint.AddNativeNode(node1); blueprint.Init(0); Console.WriteLine(2); demoForm.RenderLogic = blueprint; demoForm.Show(); StgSharp.Terminate(); /**/ } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); InternalIO.InternalWriteLog( ex.Message + "\n" + ex.StackTrace, LogType.Error); } } } }