diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/push.bat b/push.bat new file mode 100644 index 0000000..d2de0ea --- /dev/null +++ b/push.bat @@ -0,0 +1,6 @@ +@echo off +cls +Set /p text= +git add --all +git commit -m "%text%" +git push origin master \ No newline at end of file diff --git a/src/App.config b/src/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/src/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Form1.Designer.cs b/src/Form1.Designer.cs new file mode 100644 index 0000000..dae38d5 --- /dev/null +++ b/src/Form1.Designer.cs @@ -0,0 +1,57 @@ +namespace JuicyGraphics { + partial class mainForm { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.canvas1 = new JuicyGraphics.canvas(); + ((System.ComponentModel.ISupportInitialize)(this.canvas1)).BeginInit(); + this.SuspendLayout(); + // + // canvas1 + // + this.canvas1.Dock = System.Windows.Forms.DockStyle.Fill; + this.canvas1.Location = new System.Drawing.Point(0, 0); + this.canvas1.Name = "canvas1"; + this.canvas1.Size = new System.Drawing.Size(704, 521); + this.canvas1.TabIndex = 0; + this.canvas1.Text = "canvas1"; + // + // mainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(704, 521); + this.Controls.Add(this.canvas1); + this.Name = "mainForm"; + this.Text = "JuicyGraphics"; + ((System.ComponentModel.ISupportInitialize)(this.canvas1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private canvas canvas1; + } +} + diff --git a/src/Form1.cs b/src/Form1.cs new file mode 100644 index 0000000..21d5ab2 --- /dev/null +++ b/src/Form1.cs @@ -0,0 +1,40 @@ +using SharpGL; +using SharpGL.Enumerations; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace JuicyGraphics { + public partial class mainForm : Form { + public mainForm() { + InitializeComponent(); + } + + private void openGLControl1_Load(object sender, EventArgs e) { + + } + + //private void openGLControl1_OpenGLDraw(object sender, SharpGL.RenderEventArgs args) { + // OpenGL GL = ((OpenGLControl)sender).OpenGL; + // //GL.SetDimensions(Width, Height); + // GL.Viewport(0, 0, Width, Height); + // GL.Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); + // GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); + // GL.ClearColor(0f, 0.3f, 0.7f, 1f); + + // GL.Begin(BeginMode.Triangles); + // GL.Color(1.0, 0.0, 0.0); + // GL.Vertex(1.0, 1.0); + // GL.Vertex(-1.0, -1.0); + // GL.Vertex(-1.0, 1.0); + // GL.End(); + // GL.Flush(); + //} + } +} diff --git a/src/Form1.resx b/src/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/src/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/src/JuicyGraphics.csproj b/src/JuicyGraphics.csproj new file mode 100644 index 0000000..d4dd424 --- /dev/null +++ b/src/JuicyGraphics.csproj @@ -0,0 +1,94 @@ + + + + + Debug + AnyCPU + {16C2014C-E12A-4497-88D7-7DD4897716ED} + WinExe + JuicyGraphics + JuicyGraphics + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\SharpGL.2.4.0.0\lib\net40\SharpGL.dll + + + packages\SharpGL.2.4.0.0\lib\net40\SharpGL.SceneGraph.dll + + + packages\SharpGL.WinForms.2.4.0.0\lib\net40\SharpGL.WinForms.dll + + + + + + + + + + + + + + + + Component + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/src/JuicyGraphics.sln b/src/JuicyGraphics.sln new file mode 100644 index 0000000..d058919 --- /dev/null +++ b/src/JuicyGraphics.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JuicyGraphics", "JuicyGraphics.csproj", "{16C2014C-E12A-4497-88D7-7DD4897716ED}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {16C2014C-E12A-4497-88D7-7DD4897716ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16C2014C-E12A-4497-88D7-7DD4897716ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16C2014C-E12A-4497-88D7-7DD4897716ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16C2014C-E12A-4497-88D7-7DD4897716ED}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Program.cs b/src/Program.cs new file mode 100644 index 0000000..24c3c07 --- /dev/null +++ b/src/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace JuicyGraphics { + static class Program { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new mainForm()); + } + } +} diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7562c6e --- /dev/null +++ b/src/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("JuicyGraphics")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("JuicyGraphics")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("16c2014c-e12a-4497-88d7-7dd4897716ed")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Properties/Resources.Designer.cs b/src/Properties/Resources.Designer.cs new file mode 100644 index 0000000..808f911 --- /dev/null +++ b/src/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace JuicyGraphics.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JuicyGraphics.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/Properties/Resources.resx b/src/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/src/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/Properties/Settings.Designer.cs b/src/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d1fd434 --- /dev/null +++ b/src/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace JuicyGraphics.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/src/Properties/Settings.settings b/src/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/src/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/canvas.cs b/src/canvas.cs new file mode 100644 index 0000000..87c2049 --- /dev/null +++ b/src/canvas.cs @@ -0,0 +1,86 @@ +using System; +using System.Windows.Forms; +using System.Diagnostics; +using SharpGL.Enumerations; +using SharpGL.Version; +using SharpGL; +using System.ComponentModel; + +namespace JuicyGraphics { + class canvas : Control, ISupportInitialize { + + protected OpenGL GL = new OpenGL(); + + public canvas() { + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + InitializeOpenGL(); + } + + protected void InitializeOpenGL() { + GL.Create(OpenGLVersion.OpenGL2_1, RenderContextType.NativeWindow, Width, Height, 32, this.Handle); + GL.ShadeModel(OpenGL.GL_SMOOTH); + GL.ClearDepth(1.0f); + GL.Enable(OpenGL.GL_DEPTH_TEST); + GL.DepthFunc(OpenGL.GL_LEQUAL); + GL.Hint(OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, OpenGL.GL_NICEST); + GL.Viewport(0, 0, Width, Height); + } + + bool renderingForDesigner() { + if (this == null) + return false; + if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) + return true; + Control p = this.Parent; + while (p != null) { + if (p.GetType().FullName.Contains(".DesignerFrame")) + return true; + p = p.Parent; + } + return false; + } + + protected override void OnPaintBackground(PaintEventArgs e) { + if (renderingForDesigner()) { base.OnPaintBackground(e); } + return; + } + protected override void OnPaint(PaintEventArgs e) { + if (renderingForDesigner()) { + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + InitializeOpenGL(); + } + GL.MakeCurrent(); + GL.ClearColor(0f, 0.3f, 0.7f, 1f); + GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); + + GL.Begin(BeginMode.Triangles); + GL.Color(0.8, 0.1, 0.1); + GL.Vertex(1.0, 1.0); + GL.Vertex(-1.0, -1.0); GL.Vertex(-1.0, 1.0); + GL.End(); + GL.Flush(); + + var handleDeviceContext = e.Graphics.GetHdc(); + GL.Blit(handleDeviceContext); + e.Graphics.ReleaseHdc(handleDeviceContext); + } + + protected override void OnSizeChanged(EventArgs e) { + if (GL.RenderContextProvider == null) + return; + GL.SetDimensions(Width, Height); + GL.Viewport(0, 0, Width, Height); + Invalidate(); + } + + public void BeginInit() { + } + + public void EndInit() { + InitializeOpenGL(); + OnSizeChanged(null); + } + } +} \ No newline at end of file diff --git a/src/packages.config b/src/packages.config new file mode 100644 index 0000000..2dab5a5 --- /dev/null +++ b/src/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file