This Time, some Real Computer Achievement

Contrarily to how easy it was to set up my Joystick the other day, yesterday and today I have been busy with the laptop I name ‘Klystron’ that actually required some computer-skills on my part.

It was a subject of mine for a long time, how 3D Game Design works, and in particular, how the raster-based DirectX or OpenGL rendering works. To study that subject in my private time, I have always maintained a set of programs, that would in theory enable me to create a game.

In practice, creating any game decent enough to play, requires oodles of time and work. But I always felt that the software-tools involved should belong to my collection, even if I do not really put them to thorough use.

One software tools I have been pursuing, is the graphics rendering engine called “OGRE“. For several years I have been trying to custom-compile OGRE 1.10, just because that version offers better support for OpenGL 3, which should give game authors access to Geometry Shaders. But as it happens, I have ‘Mesa‘ drivers installed on that laptop, that do claim to create support for OpenGL 3, but that oddly, do not go so far as to offer Geometry Shaders. This is not a fault of the OGRE development team.

Also, there are reasons for which I do not simply ditch the Mesa drivers for ‘fglrx‘, the latter of which would give me OpenGL 4: I find it important enough, that the Mesa drivers allow hardware-acceleration of regular, high-def, 2D video streams. I would not want a real video stream / movie to become a burden to my CPU, and the fglrx do not GPU-accelerate that. So I stick with the Mesa drivers.

But then there was only one good way to get my OGRE install stable. I had to switch the Mercurial version of it I was subscribing to, down to OGRE 1.9, which is highly stable. The only issue with that remains, that OGRE 1.10 would have been my only game engine, which would have ever offered me full OpenGL 3. Which was just not stable on that box.

Now that the OGRE version on ‘Klystron’ is a sensible 1.9, that also means the engine has no extreme advantage over other game engines I possess. They all tend to be of the vanilla variety, that offer OpenGL 2 / DirectX 9c… – GL 3 would be equivalent to Dx 10, and GL equivalent to Dx 11.

Speaking of vanilla, I also installed the latest snapshot of Crystal Space on ‘Klystron': Version 2.1 ! I am amazed at how much better this latest build of Crystal Space seems, in terms of being stable when compiled, than earlier builds of it were.

Continue reading This Time, some Real Computer Achievement

Print Friendly, PDF & Email

Joysticks and Flight Simulators

I just bought myself a “Logitech Extreme 3D Pro” USB Joystick. One main reason I did so, was out of curiosity, and wanting to know whether it would work under Linux.

As it turns out, this joystick is readily recognized on my laptop ‘Klystron’ as a run-out-of-the-box, plug-and-play. Yet, I was also curious about the kernel module issue. As the reader may recall, ‘Klystron’ has Kernel version 4.4.0… What this means, is that the exact naming of the kernel modules on that machine may not coincide with yours. Further, having Kernel 4.4.0 may also be a main reason, for which this joystick just works out-of-the-box. I did read that on certain other machines, the user needs to ensure that correct kernel modules are loaded, manually.

In order to test the joystick first, I installed and then ran a program called ‘jstest-gtk‘, which is the GUI version of ‘jstest‘. I found with a simple ‘lsmod‘ command, much to my surprise, that the kernel module ‘joydev‘ was already loaded, before I even plugged in my new joystick, but that ‘usbhid‘ was not. Some quick inspection through the ‘jstest-gtk‘ utility explained why.

Apparently, the Hewlett-Packard laptop I am using has a built-in accelerometer, announced as though it was the first joystick, and this may be due to a feature which, under Windows, warns the laptop that it is falling, and which under Windows, tells the hard-drive to park its head, to minimize damage when actually dropped.

Under Linux, I cannot expect such a reaction, but now know that the accelerometer starts out mapped as a joystick with 3 axes.

The “Logitech Extreme 3D Pro” is a twist-stick, which refers to how one controls the rudder pedals. Once I plugged it in, the kernel modules ‘usbhid‘ and a few specialized ones also loaded.

What I did next, was to start a Debian application named “Flightgear“, of which I have v3.0.0 installed from the package manager, and I began my first trials at getting the engine of a simple Cessna started.

Even as I was testing the joystick using the other GUI tool, and then within Flightgear, I noticed a strange drawback to the way the joystick configures itself. It seems to have a rather large dead-zone. Once I got the Cessna moving, I noticed again, that with such a large dead-zone in the middle of my joystick ranges, it was a bit of a challenge just to force the aircraft to accelerate straight, down the center of the runway, and then to make a controlled ascent.

One fact which this experience betrays, is that I am a complete noob at flight simulators. This might actually be the 5th time I have actually tried one out in my life. Maybe.

One fact which I should note, is that if Flightgear is not challenging enough for some users, then it is also possible to buy a paid-for application named “X-Plane“, of which there is a Linux version, and of which I only possess the minimalistic, Android-tablet version. I found it was quite challenging enough for me, just to get this one little Cessna working. I will not be needing more, right away.

As for the dead-zones, the GUI tool ‘jstest-gtk‘ has a dialog that allows the joystick to be calibrated. This application reassures the user, that unplugging the joystick or rebooting will reset the calibration. Yet, it might attempt to screw things up. So I guess that I will just tolerate large dead-zones for now.

But that short Cessna flight was already quite fun! :-)

Dirk

 

Print Friendly, PDF & Email

Momentary Software Update Today

By default, “WordPress” blogs are actually stored on a “MySQL server”, so that actual ‘PHP’ scripts access this database, and render it as HTML from the Web server.

Today the Linux package manager installed an update to the MySQL server running on this box. This also triggered a restart of the server-instance running centrally as user ‘root‘. Therefore, access to my blog may have been affected briefly, from 18h50 until about 18h55 today.

I apologize for any inconvenience.

Dirk

 

Print Friendly, PDF & Email

libsamplerate

In This Posting, I gave much thought, to how the ‘Digital Audio Workstation’ named QTractor might hypothetically do a sample-rate conversion.

I thought of several combinations, of “Half-Band Filters” that are based on the Sinc Function, and ‘Polynomial Smoothing’. The latter possibility would have often caused a computational penalty. But there was one, simpler combination of methods, which I did not think of.

QTractor uses a GPL Linux library named ‘libsamplerate‘. Its premise starts out with the idea, that a number of Half-Band Filters can be applied in correct sequences with 2x oversampling or 2x down-sampling, to achieve a variety of effects.

But then, ‘libsamplerate‘ does something ingenious in its simplicity: A Linear Interpolation! Linear interpolation will not offer as clean a spectrum as polynomial smoothing will in one step. But then, this library makes up for that, by just offering a finer resolution of oversampling, if the client application chooses it.

This library offers three quality levels:

  1. SRC_SINC_FASTEST
  2. SRC_SINC_MEDIUM_QUALITY
  3. SRC_SINC_BEST_QUALITY

 

Now, in This Posting, I identified an additional issue which arises, when we are doing an “Arbitrary Re-Sampling” and down-sampling. This issue was, that the source stream contains frequency components that are higher than the output stream Nyquist Frequency, and which need to be eliminated, even though the output stream is not in sync with the source stream.

To the best of my understanding, this problem can be solved, by making a temporary output stream 2x as fast as the final output stream, and then down-sampling by a factor of 2 again…

Sincerely,

Dirk

(Edit 07/21/2016 : ) The ‘GPL’ requires that this library be kept as free software, because it is in the nature of the GPL license, that any work derived from the code must also stay GPL, which stands of the “General Public License”.

But, because the possibility exists of some commercial exploitation being sought after, the Open-Source Software movement allows for a type of license, which is called the ‘LGPL’, which stands for the “Lesser General Public License”. The LGPL will allow for some software to be derived from the original code, which can be migrated into the private domain, so that the author of the derived code may close their source-code and sell their product for profit.

There exists a library similar to this one, that is named ‘libresample‘, with the express purpose that that one be LGPL code.

Yet, the authors of ‘libsamplerate‘ believe that this GPL version of the library is the superior one, which they would therefore have kept in the public domain.


 

Continue reading libsamplerate

Print Friendly, PDF & Email