Skip to content

Commit e29d12b

Browse files
Minor example spelling/grammar tweaks & optimizations (#457)
* Removing superfluous Use() calls from SetUniform Both as good practice and the approach used, these are superfluous and potentially confusing when debugging * Small Spelling and Grammar adjustments
1 parent 775ead6 commit e29d12b

File tree

33 files changed

+36
-67
lines changed

33 files changed

+36
-67
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ on:
55
paths:
66
- 'src/**/*'
77
- 'build/nuke/*'
8+
- 'examples/**/*'
89
branches:
910
- 'main'
1011
- 'release/*'
1112
pull_request:
1213
paths:
1314
- 'src/**/*'
1415
- 'build/nuke/*'
16+
- 'examples/**/*'
1517

1618
jobs:
1719
Build:

examples/CSharp/Tutorial 1.3 - Abstractions/Shader.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public void SetUniform(string name, int value)
5252
{
5353
throw new Exception($"{name} uniform not found on shader.");
5454
}
55-
Use();
5655
_gl.Uniform1(location, value);
5756
}
5857

@@ -63,7 +62,6 @@ public void SetUniform(string name, float value)
6362
{
6463
throw new Exception($"{name} uniform not found on shader.");
6564
}
66-
Use();
6765
_gl.Uniform1(location, value);
6866
}
6967

@@ -75,7 +73,7 @@ public void Dispose()
7573

7674
private uint LoadShader(ShaderType type, string path)
7775
{
78-
//To load a single shader we need to load
76+
//To load a single shader we need to:
7977
//1) Load the shader from a file.
8078
//2) Create the handle.
8179
//3) Upload the source to opengl.

examples/CSharp/Tutorial 1.3 - Abstractions/shader.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//Specifying the version like in our vertex shader.
22
#version 330 core
33
//The input variables, again prefixed with an f as they are the input variables of our fragment shader.
4-
//These have to share name for now even tho there is a way around this later on.
4+
//These have to share name for now even though there is a way around this later on.
55
in vec4 fColor;
66

77
//The output of our fragment shader, this just has to be a vec3 or a vec4, containing the color information about

examples/CSharp/Tutorial 1.3 - Abstractions/shader.vert

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
#version 330 core
33
//These lines specify the location and type of our attributes,
44
//the attributes here are prefixed with a "v" as they are our inputs to the vertex shader
5-
//this isnt strictly necessary tho, but a good habbit.
5+
//this isn't strictly necessary though, but a good habit.
66
layout (location = 0) in vec3 vPos;
77
layout (location = 1) in vec4 vColor;
88

99
//This is how we declare a uniform, they can be used in all our shaders and share the same name.
10-
//This is prefixed with a u as its our uniform.
10+
//This is prefixed with a u as it's our uniform.
1111
uniform float uBlue;
1212

13-
//This is our output variables, notice that this is prefixed with an f as its the input of our fragment shader.
13+
//This is our output variable, notice that this is prefixed with an f as it's the input of our fragment shader.
1414
out vec4 fColor;
1515

1616
void main()
1717
{
18-
//gl_Position, is a builting variable on all vertex shaders that will specify the position of our vertex.
18+
//gl_Position, is a built-in variable on all vertex shaders that will specify the position of our vertex.
1919
gl_Position = vec4(vPos, 1.0);
2020
//The rest of this code looks like plain old c (almost c#)
2121
vec4 color = vec4(vColor.rb / 2, uBlue, vColor.a); //Swizzling and constructors in glsl.

examples/CSharp/Tutorial 1.4 - Textures/Shader.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public void SetUniform(string name, int value)
4242
{
4343
throw new Exception($"{name} uniform not found on shader.");
4444
}
45-
Use();
4645
_gl.Uniform1(location, value);
4746
}
4847

@@ -53,7 +52,6 @@ public void SetUniform(string name, float value)
5352
{
5453
throw new Exception($"{name} uniform not found on shader.");
5554
}
56-
Use();
5755
_gl.Uniform1(location, value);
5856
}
5957

examples/CSharp/Tutorial 1.4 - Textures/Texture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public unsafe Texture(GL gl, string path)
1717
//Loading an image using imagesharp.
1818
Image<Rgba32> img = (Image<Rgba32>) Image.Load(path);
1919
//We need to flip our image as image sharps coordinates has origin (0, 0) in the top-left corner,
20-
//where as openGL has origin in the bottom-left corner.
20+
//whereas openGL has origin in the bottom-left corner.
2121
img.Mutate(x => x.Flip(FlipMode.Vertical));
2222

2323
fixed (void* data = &MemoryMarshal.GetReference(img.GetPixelRowSpan(0)))

examples/CSharp/Tutorial 1.5 - Transformations/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static void OnLoad()
7272

7373
Texture = new Texture(Gl, "silk.png");
7474

75-
//Unlike in the transformation, because of our abstraction order dosent matter here.
75+
//Unlike in the transformation, because of our abstraction, order doesn't matter here.
7676
//Translation.
7777
Transforms[0] = new Transform();
7878
Transforms[0].Position = new Vector3(0.5f, 0.5f, 0f);

examples/CSharp/Tutorial 1.5 - Transformations/Shader.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public void SetUniform(string name, int value)
4343
{
4444
throw new Exception($"{name} uniform not found on shader.");
4545
}
46-
Use();
4746
_gl.Uniform1(location, value);
4847
}
4948

@@ -55,7 +54,6 @@ public unsafe void SetUniform(string name, Matrix4x4 value)
5554
{
5655
throw new Exception($"{name} uniform not found on shader.");
5756
}
58-
Use();
5957
_gl.UniformMatrix4(location, 1, false, (float*) &value);
6058
}
6159

@@ -66,7 +64,6 @@ public void SetUniform(string name, float value)
6664
{
6765
throw new Exception($"{name} uniform not found on shader.");
6866
}
69-
Use();
7067
_gl.Uniform1(location, value);
7168
}
7269

examples/CSharp/Tutorial 1.5 - Transformations/Transform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class Transform
66
{
77
//A transform abstraction.
88
//For a transform we need to have a position a scale and a rotation,
9-
//depending on what application you are creating the type for these may vary.
9+
//depending on what application you are creating, the type for these may vary.
1010

1111
//Here we have chosen a vec3 for position, float for scale and quaternion for rotation,
1212
//as that is the most normal to go with.

examples/CSharp/Tutorial 2.1 - Co-ordinate Systems/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Program
2121
private static Texture Texture;
2222
private static Shader Shader;
2323

24-
//Setup the cameras location, and relative up and right directions
24+
//Setup the camera's location, and relative up and right directions
2525
private static Vector3 CameraPosition = new Vector3(0.0f, 0.0f, 3.0f);
2626
private static Vector3 CameraTarget = Vector3.Zero;
2727
private static Vector3 CameraDirection = Vector3.Normalize(CameraPosition - CameraTarget);

0 commit comments

Comments
 (0)