Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Chapter1/2-HelloTriangle/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected override void OnUnload()
GL.DeleteBuffer(_vertexBufferObject);
GL.DeleteVertexArray(_vertexArrayObject);

GL.DeleteProgram(_shader.Handle);
GL.DeleteProgram(_shader.ID);

base.OnUnload();
}
Expand Down
2 changes: 1 addition & 1 deletion Chapter1/4-Shaders-Uniforms/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override void OnRenderFrame(FrameEventArgs e)

// This gets the uniform variable location from the frag shader so that we can
// assign the new green value to it.
int vertexColorLocation = GL.GetUniformLocation(_shader.Handle, "ourColor");
int vertexColorLocation = GL.GetUniformLocation(_shader.ID, "ourColor");

// Here we're assigning the ourColor variable in the frag shader
// via the OpenGL Uniform method which takes in the value as the individual vec values (which total 4 in this instance).
Expand Down
26 changes: 26 additions & 0 deletions Chapter3/1-ModelLoading/1-ModelLoading.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<RootNamespace>LearnOpenTK</RootNamespace>
<AssemblyName>LearnOpenTK</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>

<ItemGroup>
<None Include="Resources/**" CopyToOutputDirectory="PreserveNewest" />
<None Include="Shaders/**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="OpenTK" Version="4.8.2" />
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
<PackageReference Include="AssimpNet" Version="4.1.0" />
<PackageReference Include="StbImageSharp" Version="2.27.13" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Common\Common.csproj" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions Chapter3/1-ModelLoading/1-ModelLoading.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "1-ModelLoading", "1-ModelLoading.csproj", "{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5387BE4E-2DD0-4891-B439-5DDAEBEFB0F1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {57349D06-7972-4770-A2BD-D0B41770C0D5}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions Chapter3/1-ModelLoading/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using OpenTK.Mathematics;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;

namespace LearnOpenTK
{
public static class Program
{
private static void Main()
{
var nativeWindowSettings = new NativeWindowSettings()
{
ClientSize = new Vector2i(800, 600),
Title = "LearnOpenTK - Model Loading",
// This is needed to run on macos
Flags = ContextFlags.ForwardCompatible,
};

using (var window = new Window(GameWindowSettings.Default, nativeWindowSettings))
{
window.Run();
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions Chapter3/1-ModelLoading/Resources/Objects/Backpack/backpack.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Blender MTL File: 'None'
# Material Count: 1

newmtl Scene_-_Root
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2
map_Kd diffuse.jpg
map_Bump normal.png
map_Ks specular.jpg

Loading