ogldev-silk
Port of the OGLdev Modern OpenGL Tutorials examples from C++ to C#, featuring Silk.NET
Notes:
I've done as much as possible to keep the OpenGL code 1:1 with OGLdev's C++, but there's a couple things that are definitely different.
-
VAOs: The original Tutorials don't use a VAO until Tutorial10, instead opting to depend on GLUT-Weirdness. As Silk.NET does not expose this functionallity and it is also not good OpenGL-Practice I use a VAO in these episodes, but explain it in more detail when apropriate. [Source: Robbe and Redstone#8025 Silk.NET Discord]
-
Windowing: I elected to use Silk.NET's SDL bindings for windowing rather than GLUT simply because Silk.NET doesn't have bindings to GLUT, and SDL is what Silk.NET's own examples use.
-
Program Structure: Silk.NET's window management is structured differently from GLUT's, making use of event handlers like
OnLoad()
. For the overall structure of each program I used the same approach as Silk.NET's examples.
Other things were kepts exactly the same.
-
Naming Conventions: When it comes to naming variables and functions I chose to copy OGLdev's naming conventions as closely as possible, which means the code is a little ugly by C# standards.
-
Shaders: GLSL works the same whether you're using C++ or C#, so the shaders are 100% copy-pasted from OGLdev's example code with no changes at all.
Progress:
# | Title | Status | Links |
---|---|---|---|
1 | Open a window | Ported | Source / Tutorial |
2 | Hello dot! | Ported | Source / Tutorial |
3 | First triangle | Ported | Source / Tutorial |
4 | Shaders | Ported | Source / Tutorial |
5 | Uniform variables | Ported | Source / Tutorial |
6 | Translation transformation | Ported | Source / Tutorial |
7 | Rotation transformation | Ported | Source / Tutorial |
8 | Scaling transformation | Ported | Source / Tutorial |
9 | Interpolation | Ported | Source / Tutorial |
10 | Indexed draws | Ported | Source / Tutorial |
11 | Concatenating transformations | Ported | Source / Tutorial |
12 | Perspective Projection | Bugged | Source / Tutorial |
References:
The Tutorials: OGLdev Modern OpenGL Tutorials (Original C++ code available there)
Silk.NET Examples: Silk.NET OpenGL Tutorials
Special thanks to WholesomeIsland for their handy Silk.NET abstractions, parts of which I'm using in place of some of GLUT's features: GitHub