Sunday, October 23, 2016

Trees and mountains and bright colors!

I'm still hitting some snags with the wind code, so I decided to take a break and work on something else for a bit.  First, I spent a short while porting to C# a very simple OpenGL flight simulator written in C.  It was on a college website and appears to be a starting point for future assignments.  It served as a useful starting point, but it is quite limited.

Flight sim, unsmoothed
I experimented with a few modifications, but the program is really quite limited, and is written for old-school OpenGL (OpenGL 1.1 or so) so extensive terrain display would be difficult due to the fundamental constraints, without writing a lot of code to compensate.  Still, it was a nice bit of fun.  Alas, the terrain looked too harshly faceted, but my attempt to resolve this through calculating normals to smooth the terrain left it looking bland instead.  Oh, well.

It looks worse with smoothing.

The other thing I messed around with is a series of OpenGL game tutorials.  Though the tutorials are aimed at building a Java-based game engine, it is serving quite well at helping me experiment with modern OpenGL using C# and the OpenTK library.  I just completed tutorial 14, which creates (flat) terrain and populates the land with a large number of trees.  I'd played around with OpenGL 3.3 and later using C++ and examples from the OpenGL SuperBible Fifth Edition, and via various graphics and gaming engines, but I'm liking this approach better so far.  I'm not sure I agree with some aspects of the engine design, and will likely only be using it as a starting point or reference for further work. Regardless, it is an excellent tutorial and suitable for some basic games.  Personally, my plan is to get far enough to have walking and flying navigation modes available and be able to load up terrain from file or generate it on the fly.  I have no specific game idea in mind, mostly just want to be able to look at the terrains I'm generating from other programs.  We'll see what happens.

At the end of tutorial 14, you too can run through the randomly-arranged instances of the tree model!

No comments:

Post a Comment