Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ class Program
private static Texture Texture;
private static Shader Shader;

// OpenGL has image origin in the bottom-left corner.
private static readonly float[] Vertices =
{
//X Y Z U V
0.5f, 0.5f, 0.0f, 1f, 1f,
0.5f, -0.5f, 0.0f, 1f, 0f,
-0.5f, -0.5f, 0.0f, 0f, 0f,
-0.5f, 0.5f, 0.5f, 0f, 1f
0.5f, 0.5f, 0.0f, 1f, 0f,
0.5f, -0.5f, 0.0f, 1f, 1f,
-0.5f, -0.5f, 0.0f, 0f, 1f,
-0.5f, 0.5f, 0.5f, 0f, 0f
};

private static readonly uint[] Indices =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ public unsafe Texture(GL gl, string path)
{
//Loading an image using imagesharp.
Image<Rgba32> img = (Image<Rgba32>) Image.Load(path);
//We need to flip our image as image sharps coordinates has origin (0, 0) in the top-left corner,
//whereas openGL has origin in the bottom-left corner.
img.Mutate(x => x.Flip(FlipMode.Vertical));

// OpenGL has image origin in the bottom-left corner.
fixed (void* data = &MemoryMarshal.GetReference(img.GetPixelRowSpan(0)))
{
//Loading the actual image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class Program
private static readonly float[] Vertices =
{
//X Y Z U V
0.5f, 0.5f, 0.0f, 1f, 1f,
0.5f, -0.5f, 0.0f, 1f, 0f,
-0.5f, -0.5f, 0.0f, 0f, 0f,
-0.5f, 0.5f, 0.5f, 0f, 1f
0.5f, 0.5f, 0.0f, 1f, 0f,
0.5f, -0.5f, 0.0f, 1f, 1f,
-0.5f, -0.5f, 0.0f, 0f, 1f,
-0.5f, 0.5f, 0.5f, 0f, 0f
};

private static readonly uint[] Indices =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public class Texture : IDisposable
public unsafe Texture(GL gl, string path)
{
Image<Rgba32> img = (Image<Rgba32>) Image.Load(path);
img.Mutate(x => x.Flip(FlipMode.Vertical));


fixed (void* data = &MemoryMarshal.GetReference(img.GetPixelRowSpan(0)))
{
Load(gl, data, (uint) img.Width, (uint) img.Height);
Expand Down
68 changes: 34 additions & 34 deletions examples/CSharp/OpenGL Tutorials/Tutorial 2.2 - Camera/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,47 @@ class Program
private static readonly float[] Vertices =
{
//X Y Z U V
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
0.5f, -0.5f, -0.5f, 1.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,

-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,

-0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
-0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
-0.5f, 0.5f, 0.5f, 1.0f, 0.0f,

0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
0.5f, 0.5f, 0.5f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-0.5f, 0.5f, 1.0f, 1.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,

-0.5f, 0.5f, -0.5f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 0.0f
};

private static readonly uint[] Indices =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public class Texture : IDisposable
public unsafe Texture(GL gl, string path)
{
Image<Rgba32> img = (Image<Rgba32>) Image.Load(path);
img.Mutate(x => x.Flip(FlipMode.Vertical));


fixed (void* data = &MemoryMarshal.GetReference(img.GetPixelRowSpan(0)))
{
Load(gl, data, (uint) img.Width, (uint) img.Height);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading