public void TestCompile() { var window = new OpenGLWindow(200, 200, "Test", false, false); new ShaderPipeline( DefaultShader.FromType(typeof(VertexPositionColor), ShaderType.Vertex), DefaultShader.FromType(typeof(VertexPositionColor), ShaderType.Fragment)); new ShaderPipeline( DefaultShader.FromType(typeof(VertexPosition3Color), ShaderType.Vertex), DefaultShader.FromType(typeof(VertexPosition3Color), ShaderType.Fragment)); new ShaderPipeline( DefaultShader.FromType(typeof(VertexPositionTexture), ShaderType.Vertex), DefaultShader.FromType(typeof(VertexPositionTexture), ShaderType.Fragment)); new ShaderPipeline( DefaultShader.FromType(typeof(VertexPosition3Texture), ShaderType.Vertex), DefaultShader.FromType(typeof(VertexPosition3Texture), ShaderType.Fragment)); new ShaderPipeline( DefaultShader.FromType(typeof(VertexPositionColorTexture), ShaderType.Vertex), DefaultShader.FromType(typeof(VertexPositionColorTexture), ShaderType.Fragment)); new ShaderPipeline( DefaultShader.FromType(typeof(VertexPosition3ColorTexture), ShaderType.Vertex), DefaultShader.FromType(typeof(VertexPosition3ColorTexture), ShaderType.Fragment)); window.Close(); window.Dispose(); }
public void Run() { PlainCoreSettings.GlfwSearchPath = Path.GetFullPath("../../../../../Native/"); var window = new OpenGLWindow(800, 600, "Hello Core!", false, false); window.OnClosed += () => Console.WriteLine("Closed!"); Setup(); while (window.IsOpen) { defaultFramebuffer.Clear(Color4.CornflowerBlue); window.PollEvents(); Draw(); window.Display(); } pipeline.Dispose(); vao.Dispose(); buffer.Dispose(); indexBuffer.Dispose(); texture.Dispose(); defaultFramebuffer.Dispose(); window.Dispose(); }
public virtual void OnRenderFrame(FrameEventArgs args, OpenGLWindow parent) { GL.BindVertexArray(VertexArrayObject); var t = parent.Projection * _ModelView; _shader.SetMatrix4(Shader.ShaderMatrix.model, ref t); }
static void Main(string[] args) { logger.Info("Starting main application"); OpenGLWindow window = new OpenGLWindow(1024, 768); window.Run(); }
private void OpenGLWorker_DoWork(object sender, DoWorkEventArgs e) { OpenGLWindow openGLWindow = new OpenGLWindow(); // TODO: fix! //openGLWindow.vertices = lAllVertices; openGLWindow.Run(); }
private void OpenGLWorker_DoWork(object sender, DoWorkEventArgs e) { OpenGLWindow openGLWindow = new OpenGLWindow(); openGLWindow.vertices = lAllVertices; openGLWindow.colors = lAllColors; openGLWindow.Run(); }
public void TestCreate() { //Dummy window for context initialization var window = new OpenGLWindow(200, 200, "Test", false, false); var tex = new RenderTexture(800, 600); window.Close(); window.Dispose(); }
public override void OnRenderFrame(FrameEventArgs args, OpenGLWindow parent) { base.OnRenderFrame(args, parent); if (_useElements) { GL.DrawElements(PrimitiveType.Triangles, _indices.Length, DrawElementsType.UnsignedInt, 0); } else { GL.DrawArrays(PrimitiveType.LineLoop, 0, LocalVertices.Count); } }
private void RenderWindow() { while (true) { _openWindowSem.WaitOne(); GPU gpu = GPU.Create(500, 500, new DefaultGpuController()); _renderWindow = new OpenGLWindow(500, 500, "GPUSharp Preview Window", gpu); _renderWindow.Run(); _renderWindow.Dispose(); _renderWindow = null; if (!_isWindowOpened) { break; } _isWindowOpened = false; } }
/// <summary> /// 建構式 /// </summary> /// <param name="openGLWindow">指定欲連結的OpenGL視窗,將自動加入Paint方法至OpenGL視窗的paint事件]</param> public OpenGLView(OpenGLWindow openGLWindow) { this.OpenGLWindow = openGLWindow; this.Things2Show.V = new HashSet <ICanPlotInOpenGL>(); this.geometryBoundary = new PointD[2]; this.viewBoundary = new PointD[2]; this.BackGroundColor = Color.FromArgb(90, 90, 90); this.BoundaryGap = 0.2; this.LightOn = true; this.PlotGrid = true; this.GridColor1 = Color.FromArgb(160, 160, 160); this.GridColor2 = Color.FromArgb(70, 70, 70); this.PlotGraduation = true; this.GraduationHeight = 20; this.GraduationOutside = true; this.GraduationColor = Color.WhiteSmoke; this.GridDimension = Dimension.TwoDimension; this.graphicRangeX = 100; this.graphicRangeY = 100; this.Range = 100; this.XScale = 1.0; this.YScale = 1.0; this.ZScale = 1.0; this.AutoScale = false; this.AutoRefresh = true; this.openGLWindow.Paint += Paint; this._UpdateTimer = new System.Timers.Timer(); this._UpdateTimer.Interval = 1000; this._UpdateTimer.Elapsed += (o, e) => { Update(); Console.WriteLine("upfate"); this._UpdateTimer.Stop(); }; }
private static (WindowBase, IRenderer) CreateRenderer(Options options) { WindowBase window; IRenderer renderer; if (options.GraphicsBackend == GraphicsBackend.Vulkan) { VulkanWindow vulkanWindow = new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, (bool)options.EnableMouse); window = vulkanWindow; renderer = new VulkanGraphicsDevice((instance, vk) => new SurfaceKHR((ulong)(vulkanWindow.CreateWindowSurface(instance.Handle))), vulkanWindow.GetRequiredInstanceExtensions); } else { window = new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, (bool)options.EnableMouse); renderer = new Renderer(); } return(window, renderer); }