Compare commits

..

No commits in common. "f81baf7f3e9508dad3649a33a8f37f672e2ad4e8" and "6f7882ba7ce7439c3eb48015b95dbf2a9a14be19" have entirely different histories.

6 changed files with 9 additions and 96 deletions

View file

@ -33,15 +33,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="OpenTK">
<HintPath>Lib\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.Compatibility">
<HintPath>Lib\OpenTK.Compatibility.dll</HintPath>
</Reference>
<Reference Include="OpenTK.GLControl">
<HintPath>Lib\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="System"/> <Reference Include="System"/>
<Reference Include="System.Core"/> <Reference Include="System.Core"/>
<Reference Include="System.Xml.Linq"/> <Reference Include="System.Xml.Linq"/>
@ -63,9 +54,6 @@
</Compile> </Compile>
<Compile Include="Program.cs"/> <Compile Include="Program.cs"/>
<Compile Include="Properties\AssemblyInfo.cs"/> <Compile Include="Properties\AssemblyInfo.cs"/>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -88,8 +76,5 @@
<ItemGroup> <ItemGroup>
<None Include="App.config"/> <None Include="App.config"/>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Lib\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
</Project> </Project>

View file

@ -17,6 +17,7 @@ namespace ComputerGraphicsLab2
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
@ -28,34 +29,12 @@ namespace ComputerGraphicsLab2
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.glControl1 = new OpenTK.GLControl(); this.components = new System.ComponentModel.Container();
this.SuspendLayout();
//
// glControl1
//
this.glControl1.BackColor = System.Drawing.Color.Black;
this.glControl1.Location = new System.Drawing.Point(12, 12);
this.glControl1.Name = "glControl1";
this.glControl1.Size = new System.Drawing.Size(776, 426);
this.glControl1.TabIndex = 0;
this.glControl1.VSync = false;
this.glControl1.Load += new System.EventHandler(this.glControl1_Load);
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.glControl1); this.Text = "Form1";
this.Name = "Form1";
this.Text = "OpenGL Triangle";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
} }
#endregion #endregion
private OpenTK.GLControl glControl1;
} }
} }

View file

@ -1,71 +1,20 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace ComputerGraphicsLab2 namespace ComputerGraphicsLab2
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
private bool glLoaded = false;
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
} }
private void Form1_Load(object sender, EventArgs e)
{
// Форма загружена
}
private void glControl1_Load(object sender, EventArgs e)
{
glLoaded = true;
// Настройка OpenGL
GL.ClearColor(Color.White);
GL.Enable(EnableCap.DepthTest);
// Настройка viewport
GL.Viewport(0, 0, glControl1.Width, glControl1.Height);
// Настройка проекции
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(-2.0, 2.0, -2.0, 2.0, -1.0, 1.0);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
// Принудительная перерисовка
glControl1.Invalidate();
}
private void glControl1_Paint(object sender, PaintEventArgs e)
{
if (!glLoaded) return;
// Очистка экрана
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
// Рисование треугольника
GL.Begin(PrimitiveType.Triangles);
GL.Color3(1.0f, 0.0f, 0.0f); // красная вершина
GL.Vertex2(-1.0f, -1.0f);
GL.Color3(0.0f, 1.0f, 0.0f); // зеленая вершина
GL.Vertex2(1.0f, -1.0f);
GL.Color3(0.0f, 0.0f, 1.0f); // синяя вершина
GL.Vertex2(0.0f, 1.0f);
GL.End();
// Отображение результата
glControl1.SwapBuffers();
}
} }
} }

Binary file not shown.