I have recently started exploring OpenTK, with the hope to move directly into OpenGL. This has been predominantly for a new module I am taking; Simulation and 3D Graphics. I have always been interested in graphics, in any form. But the idea of coding graphics was one of the key draws of the University of Hull. The opportunity has finally arrived to get to grips with it, and I am running with it. Thus far I have completed all the available labs for the topic, with some success. I am confident I now understand how the program works, and how the shaders work with the program. The code is written in C# – therefore it is very familiar to me. It reminds me of XNA in many ways.
The first lab was creating a simple house using as few triangles as possible. This was fairly easy, the hardest thing to get to grips with was the different methods of using indices, especially when it came to optimizing the program. But I managed to get it to work.
From this I moved onto creating objects, and manipulating them with shaders; this had some interesting results.
The power that shadesr have over colour.
The interesting part of this for me, was the small amount of code controlling it.
The image above is formed from these vertices – however the colour only uses the last 3 coordinates of each set of 6 (or stride). These are the RGB values.
A simple change from that to this.
The changes are very very slight, so I do not blame you for missing them. It is a simple change the last 3 values of the stride, that causes a change to the outcome to be drastic; as shown below.
Obviously there is alot of other code, that has set up the shaders to work like this. This is shown here.
Moving forward from this lab, I went on to look at the camera and how it works. From this I was able to control the view, and move around the world. In addition using the .CreateRotationZ, .CreateRotationX, .CreateRotationY, methods I was able to view the objects I created from 3 dimensions. This allowed for depth to be viewed and using what I learned I was able to draw a cube of cubes.
I know I have a long way to go, but I am excited to explore this medium more. Especially knowing the next topic is lighting a scene!