From 82ef4cb776563047ddbe8de2372c64c91a676bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B5=D0=BE=D1=80=D0=B3=D0=B8=D0=B9=20=D0=A6=D1=8B?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Sat, 22 Apr 2017 02:53:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tiSTLviewer/tiSTLviewer/Form1.Designer.cs | 79 ++++++++++++- tiSTLviewer/tiSTLviewer/Form1.cs | 38 ++++++- tiSTLviewer/tiSTLviewer/Form1.resx | 123 +++++++++++++++++++++ tiSTLviewer/tiSTLviewer/packages.config | 4 + tiSTLviewer/tiSTLviewer/tiSTLviewer.csproj | 8 ++ 5 files changed, 249 insertions(+), 3 deletions(-) create mode 100644 tiSTLviewer/tiSTLviewer/Form1.resx create mode 100644 tiSTLviewer/tiSTLviewer/packages.config diff --git a/tiSTLviewer/tiSTLviewer/Form1.Designer.cs b/tiSTLviewer/tiSTLviewer/Form1.Designer.cs index 8ae19dd..bcbea56 100644 --- a/tiSTLviewer/tiSTLviewer/Form1.Designer.cs +++ b/tiSTLviewer/tiSTLviewer/Form1.Designer.cs @@ -28,12 +28,87 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.panel_main = new System.Windows.Forms.Panel(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(442, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.toolStripMenuItem1, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.openToolStripMenuItem.Text = "Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.exitToolStripMenuItem.Text = "Exit"; + // + // panel_main + // + this.panel_main.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel_main.Location = new System.Drawing.Point(0, 24); + this.panel_main.Name = "panel_main"; + this.panel_main.Size = new System.Drawing.Size(442, 229); + this.panel_main.TabIndex = 2; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "Form1"; + this.ClientSize = new System.Drawing.Size(442, 253); + this.Controls.Add(this.panel_main); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "tiSTLviewer"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.Panel panel_main; } } diff --git a/tiSTLviewer/tiSTLviewer/Form1.cs b/tiSTLviewer/tiSTLviewer/Form1.cs index 7b134d8..37ee4c1 100644 --- a/tiSTLviewer/tiSTLviewer/Form1.cs +++ b/tiSTLviewer/tiSTLviewer/Form1.cs @@ -1,4 +1,5 @@ -using System; +using OpenGL; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -15,6 +16,41 @@ namespace tiSTLviewer public Form1() { InitializeComponent(); + OpenGL.GlControl glc = new OpenGL.GlControl(); + glc.Dock = DockStyle.Fill; + glc.Render += Glc_Render; + glc.ContextCreated += Glc_ContextCreated; + this.panel_main.Controls.Add(glc); + } + + private void Glc_ContextCreated(object sender, GlControlEventArgs e) + { + // Here you can allocate resources or initialize state + Gl.MatrixMode(MatrixMode.Projection); + Gl.LoadIdentity(); + Gl.Ortho(0.0, 1.0f, 0.0, 1.0, 0.0, 1.0); + + Gl.MatrixMode(MatrixMode.Modelview); + Gl.LoadIdentity(); + } + + private void Glc_Render(object sender, OpenGL.GlControlEventArgs e) + { + Control senderControl = (Control)sender; + + Gl.Viewport(0, 0, senderControl.ClientSize.Width, senderControl.ClientSize.Height); + Gl.Clear(ClearBufferMask.ColorBufferBit); + + Gl.Begin(PrimitiveType.Triangles); + Gl.Color3(1.0f, 0.0f, 0.0f); Gl.Vertex2(0.0f, 0.0f); + Gl.Color3(0.0f, 1.0f, 0.0f); Gl.Vertex2(0.5f, 1.0f); + Gl.Color3(0.0f, 0.0f, 1.0f); Gl.Vertex2(1.0f, 0.0f); + Gl.End(); + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + } } } diff --git a/tiSTLviewer/tiSTLviewer/Form1.resx b/tiSTLviewer/tiSTLviewer/Form1.resx new file mode 100644 index 0000000..bbf92a2 --- /dev/null +++ b/tiSTLviewer/tiSTLviewer/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 166, 17 + + \ No newline at end of file diff --git a/tiSTLviewer/tiSTLviewer/packages.config b/tiSTLviewer/tiSTLviewer/packages.config new file mode 100644 index 0000000..e02373e --- /dev/null +++ b/tiSTLviewer/tiSTLviewer/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tiSTLviewer/tiSTLviewer/tiSTLviewer.csproj b/tiSTLviewer/tiSTLviewer/tiSTLviewer.csproj index ac158d6..91c09fb 100644 --- a/tiSTLviewer/tiSTLviewer/tiSTLviewer.csproj +++ b/tiSTLviewer/tiSTLviewer/tiSTLviewer.csproj @@ -33,6 +33,10 @@ 4 + + ..\packages\OpenGL.Net.0.2.2\lib\OpenGL.Net.dll + True + @@ -54,6 +58,9 @@ + + Form1.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -63,6 +70,7 @@ True Resources.resx + SettingsSingleFileGenerator Settings.Designer.cs