GUI programming drags on for third week

Checking off some items from the to-do list mentioned in my previous post, my OpenGL GUI panels can now have rounded corners (although they still need a bit of work as they’re not quite as circular as I’d like), they can have shadows of arbitrary size and color, they can have linear and radial gradient coloring, and the text dynamically word-wraps as necessary, with the scroll bar appearing only when needed.

Ain’t that nice? Next I need to work on vertical resizing and making sure multiple panels will overlap correctly when on the screen; a panel should be brought to the front “layer” when clicked on.

Then I will move on to adding the GUI elements I mentioned in the last post.

A fellow programmer on twitch mentioned a GUI library for LWJGL the he had programmed called legui. Looks quite nice so I might play around with it and see if I can integrate any of it with my panels. Another advantage of streaming on twitch: meeting other programmers and discovering new things!

(P.S. I don’t really know if this is my third week of working on it or not, but it’s probably around there. The title of this post is a reference to a film in which people carry in the banner.)

By S P Hannifin, ago

My GUI programming efforts continue

I’ve been continuing my efforts to program a custom simple 2D/3D engine in Java with OpenGL with which to create a more user-friendly standalone version of my MIDI animator (and hopefully some games in the future). Lately I’ve been focusing on creating a GUI system. In terms of free open-source 3D engines in Java, I don’t much like most of the GUI implementations, so creating my own has been fun. Granted, I still run in to bugs that are tricky to fix while trying to accomplish relatively simple things, but trying to solve such problems is educational and always a bit addicting, like solving a puzzle, especially as I’m doing it for myself.

So here’s my latest progress update. I’ve settled on using STBTT (included in lwjgl) font rendering for the GUI text and the underutilized Nvidia path rendering (included in OpenGL in general) for the panels (and hopefully more in the future, including possible note shapes in the actual MIDI animator). The panels are movable and can contain an arbitrary amount of word-wrapped text. You can scroll through the text, and the panel can include a y-axis scrollbar of arbitrary size. You’ll also notice that the text fades in and out at the top and bottom, a nice little touch in my opinion that I probably spent too long programming:

I’ve also been streaming my programming efforts on twitch, which is also addicting. It turns what is usually a pretty solitary activity into something at least a little more social, and it’s fun watching the viewer count tick up now and then. Shout out to twitch user Subtixx who has even offered helpful points and advice allowing me to fix problems my eyes don’t catch (such as null-checking the darn scrollbar!); many thanks Subtixx!

My current to-do list includes (but is not limited to):

  • allow gradient coloring on the panels and text
  • allow rounded corners on the panels
  • allow panels to have shadows (render a semi-transparent panel behind)
  • allow panels to be resized dynamically
  • allow panels to be closed (and maybe shrunk?)
  • allow panels to contain some select common GUI elements, such as:
    • buttons
    • text fields (short and long)
    • radio buttons
    • check boxes
    • sliders (continuous and quantified)
    • menus (pop-up and drop-down)
    • tabs on the top or side of panels (which perhaps are just specialized buttons?)

So there’s still quite a bit to do. But I must do it, for this is my quest.

In other unrelated news, a 4th album from symphonic / power metal band Ancient Bards is finally happening! I love this band and I can’t wait for their new album!

By S P Hannifin, ago
Computer games

Little Nightmares

Hey, look! I finally updated this blog’s theme! I think I like it better. Might do some more experimenting with the font, but this should work for now.

Anyway, I’ve been enjoying streaming on Twitch, and I recently finished playing the PC game Little Nightmares, a small little adventure game with a nice creepy atmosphere. It doesn’t take long to beat. My first time playing through, it took my a bit over 4 hours. Rushing through it a second time, I was able to speed through it in 1.5 hours, which I recorded for my records, because I’m sure I will want to go back and watch myself playing twenty or so years from now:

Isn’t that interesting?!

For now, I’ve moved on to playing the bright cheery anime-ish RPG Ni No Kuni II: Revenant Kingdom, which is perhaps meant for a younger audience with its super happy cheerfulness and ridiculously simple portrayal of monarchy establishment, but I must admit that I do love the art and style of the game with its amazingly beautiful cel-shading, and Joe Hisaishi’s orchestral score is fantastic, quite on par with his Studio Ghibli work. I wish they’d port the original Ni No Kuni game for PC, as I don’t have a PS3 and probably won’t be buying one anytime soon.

By S P Hannifin, ago
Computer games


Although I can’t even remember when I created a twitch account, I never actually tried streaming from it until this week, streaming a bit of a creepy puzzle / adventure game called Little Nightmares. Here’s my twitch account. And here’s an attempt at embedding the channel:

Watch live video from seanthebest on

Probably won’t actually use it much, as I don’t play video games as much as I’d like to, but as I finally have a graphics card capable of streaming, I might as well use it. Maybe I’ll stream some coding sometime as well, because that’s always really exciting.

By S P Hannifin, ago
My life

Update on random happenings…

Haven’t blogged in a while, so I thought I’d blather a bit about what I’m up to.

I can has focus?

I lamented on twitter not long ago that my lack of creative focus probably severely decreases my chance of making significant (money-making) progress in my creative endeavors. Rectifying this is easier said than done. My creative interests include writing fiction (fantasy mostly), composing music, and programming (programming stuff I’m interested in, that is, not freelance work, which is boring). I’m guessing that making decent progress in one area (the sort of progress that would lead to substantial income) likely necessitates giving up the other two for at least some extended period of time. Each creative endeavor includes its own pros and cons in terms the money-making challenges it presents. In fact, let’s make a quick graph as we reflect on what these pros and cons might be…

Writing fiction• Fun to do
• Can be done just about anywhere with a notebook and pen; not restricted to needing a computer
• Lots of competition
• Takes time to build a significant audience
• Time investment to create a product can be several months
Composing music• Instantly rewarding
• Takes the least amount of time to finish a "product" (a track of music)
• Lots of competition
• Takes time to build a significant audience or client list
Programming• Potential to make quite a lot of $$$ with the right product
• Low competition for innovative products
• Time investment is very high and hard to predict (could be months or even years)
• Can be very frustrating to fix bugs

So which endeavor to choose? I’m leaning towards music, but whichever I choose (if I’m even able to do so), it will be a torture to totally give up the other two, even if it’s only temporarily.

Out of curiosity…

Which endeavor would you choose?

View Results

Loading ... Loading ...

Writing fiction

I haven’t done any significant writing in a good long while. I’ve completely plotted several stories, and I’ve written several opening chapters, but I keep getting bored and abandoning projects. One could easily chide, “You’re supposed to stick with it, even if it’s boring!” Pshaw, I say unto you! In my opinion, if writing something is boring, then it’s a good sign you shouldn’t be writing it in the first place. Being bored completely defeats the purpose of such a creative act. If you’re bored writing it, why should a reader have any interest in it?

I kept thinking my getting bored had something to do with finding the right personal balance between plotting and pantsing, but as I reflect on why writing SON OF A DARK WIZARD managed to work for me, I believe it has more to do with how interesting I find the characters. Sorren in SON OF A DARK WIZARD, who was an arrogant brat wizard, was just insanely fun to write. So with whatever I write next, I really need to focus on making the character as interesting (for me) as possible. Of course, it’s not necessarily easy to do that. It managed to fall into place quite well for Sorren, but it isn’t obvious to me how to make a more virtuous character deeper than cardboard. Anyway, it’s something I’ll have to think more about before beginning a new draft. I have several more story ideas that I’m eager to get working on, but I want to make sure the main character really comes alive for me before I dive in.

Also, since I really don’t have much of an audience yet, I was thinking of posting my next story for free (at least temporarily) on Wattpad as I write it. That might not help much in building an audience, but it feels better than just sitting on it until I indie-pub the book. By the way, although the sequel to SON OF A DARK WIZARD has been mostly plotted for a couple years now, I don’t have the funds to pay for another cover at the level of professionalism of the first book’s cover, and I really don’t want to publish it with a cover of inconsistent quality, hence why I’m holding off on working on the sequel for now. (If you’d like to donate, let’s say, $2,000 for a cover, I’ll happily get to work on it and dedicate the book to you.)

Composing music

I’ve got several tracks in the works, and I know that I owe my Patreon subscribers 12 tracks for the six months they’ve been charged without me delivering anything! (I’ve been trying to pause donations each month, but I sometimes forget.) I am definitely committed to delivering these tracks, though as usual I can’t promise when. Life just feels very hectic right now and I don’t seem to be in a position to set a good schedule for myself, much less follow it with any amount of discipline. (This is also a deterrent to my inability to make progress in my competing creative endeavors, but one that I’m not sure I can do much about at the moment; I would need the support of other family members, and unfortunately I don’t think I’m in a position to request or enforce that.)


I’m still working on that more user-friendly MIDI animator that I blogged about earlier this year; I kinda wanna finish this, at least to some degree, before I get back to composing.

And other stuff…

Other than that, I’ve been particularly interested in math lately for some unknown reason. More specifically, I’m fascinated by the human “creation” of math. That is, how do we as humans psychologically come up with math? Euler’s formula, along with the entire idea of complex numbers (imaginary numbers), are particularly fascinating. I understand how to work with them and all that; I understand the concept. What I don’t understand is: how did Euler and mathematicians of old even come up with this concept? It doesn’t feel at all intuitive. If you think about it, Euler’s formula is an implication of the definition of complex numbers more than a “discovery”, but how did mathematicians come up with this “rotational” definition of raising numbers to the power of complex numbers? It boggles my mind. And what does it mean? That is, it’s obvious what most numbers mean even without a context, such as 2 or -3. But what does i mean? (Beyond merely sqrt(-1), which is obvious.) I’m not sure. Yet, it’s useful. Anyway, I yearn to have a deeper understanding of it, and of how mathematicians “create” (or “discover”) math in general.

Well, that’s all for now. Maybe I’ll try blogging a bit more often. I’ve been meaning to for while. I still haven’t posted a “Year’s Best” for 2017. I also hope to post another “composer’s analysis” of the last track I uploaded to YouTube, Moonwish. I’d also like to post about why Cantor’s ideas of magnitudes infinities is useless and wrong, my new(ish) understanding of the second law of thermodynamics (I think “disorder” is the wrong word, for those definitions that use it), and some interesting thoughts about DNA… but all that for another day. Later, my dear readers.

By S P Hannifin, ago
Fiction books

Used bookstore plunder

Another episode of “used bookstore plunder”! I didn’t actually spend a load of money, most of it was bought with trade credit. Anyway, here’s what I found (click picture for full resolution):

Lots of fiction, mostly Andre Norton and Michael Moorcock (who I usually have trouble finding in used bookstores). We’ve got:

  • Poul Anderson — Three Hearts and Three Lions (been keeping my eyes out for this one, glad to finally find it)
  • Orson Scott Card — Songmaster (another I’ve been keeping an eye out for)
  • L. Sprague de Camp — Land of Unreason
  • Erin Hoffman — Lance of Earth and Sky (still haven’t read the first book of this series)
  • Michael Moorcock — (I have yet to read anything by him, so I hope he’s not too bad; I hear his name a lot so I want to eventually familiarize myself with his work) The Skrayling Tree, Blood, Sword of the Dawn, The Vanishing Tower, Count Brass, The Secret of the Runestaff, The Knight of the Swords, The Eternal Champion, The Sword and the Stallion, The Swords Trilogy (they put these trilogy sets out after I had already bought two of the books included in it), The Chronicles of Corum, The Champion of Carathorm, The Queen of Swords, Stormbringer
  • Andre Norton — Songsmith, The Gate of the Cat, Moon Called, The Jargoon Pard, Elvenblood, Mirror of Destiny, Merlin’s Mirror, Shadow Hawk
  • Fred Saberhagen — Merlin’s Bones
  • Robert Silverberg  (I haven’t read any of his books, but I’ve enjoyed some of his short stories before) The Book of Skulls
  • Alexander Solzhenitsyn — August 1914, The Gulag Archipelago Vol. 1 (because Jordan Peterson)
  • Jack Vance — (Vance is another one I don’t often see in used bookstores, so I was happy to find a good number of them) The Dragon Masters, The Many Worlds of Magnus Ridolph, Son of the Tree / The Houses of Iszm, The Gray Prince, The Pnume, Slaves of the Klau, Lyonesse, Ecce and Old Earth
  • John Varley — Millennium
  • Gene Wolfe — Soldier of the Mist

Nonfiction books include:

  • The Beethoven Compendium and Musical Structure and Design
  • Master the Basics of Russian along with some old play in Russian to practice translating (I want to learn Russian, all I know so far is: Здравствуйте! да и нет, и спасибо! I don’t think that’s enough.1)
  • Game Theory: A Nontechnical Introduction and The Science of Jurassic Park and the Lost World (They were both 75 cents)
  • Chase, Chance, and Creativity (It’s about the role of chance in creativity; I’ve been fascinated by the psychological phenomenon of creativity lately, an on-and-off interest, especially in its relation to artificial intelligence)
  • Everything that Linguists have Always Wanted to Know about Logic (I’m not a linguist, but I like how this book combines and linguistics with logic; again interested in this for artificial intelligence purposes as well. If you think about it, human language is like a programming language of thought.)
  • Beyond Good and Evil by Nietzsche and For Self-Examination / Judge for Yourself by Kierkegaard (philosophy for some light weekend reading)
  • Alan Turing: The Enigma (hopefully this biography of Turing will be more interesting than the film based on it, which I thought was terrible)

Lastly, I bought two 3D blu-rays, Jurassic Park and Pacific Rim. I can’t watch them in 3D yet until I get a PSVR, but as it seems they don’t really sell them anymore (perhaps they’ve quit making them altogether?), I’m eager to get them while I can. It’s a shame they weren’t more popular, but their prices were pretty ridiculous.

So that’s my used bookstore plunder!

I haven’t finished reading any books at all this year; instead I’ve been reading a lot of fragments from non-fiction books.

By S P Hannifin, ago

1,055 books…

… are in my personal library, yay!

I had been meaning to digitally catalog my book collection for some time now. I have on several occasions found books at used bookstores that I wasn’t sure whether or not I owned yet (typically books in a series or books by prolific authors). So I finally used a free app called Libib to digitally catalog the books I own (not including eBooks at the moment; I only have perhaps a dozen of those). Next time I am wondering the shelves of a used bookstore, I can now search the app to be sure of what I have and what I don’t. Even while cataloging the books, I found a few books to weed out because I have multiple copies of them.

You can scroll through my library here:

(Unfortunately there does not yet seem to be a way to sort the public listing in any other way besides by title.)

I get a majority of books used, and have walked away with some big loads for cheap prices when stores are going out of business or getting rid of excess. I’m sure I still spend too much money on books considering my slow reading speed, but they’re addicting to collect, aren’t they?

I’ve only read around 10% of these books. Of course, some books are more for reference and not really meant to be read from front to back anyway. Still, with my current reading speed, I will likely die with the majority of these books left unread. Which is fine, because upon death I will have access to infinite knowledge… I hope.

Anyway, if you’re a book lover or collector and wish to digitize a record of your catalog, Libib is the best free app (for Android) I’ve come across so far. It also allows you to export a CSV file, which is handy.

By S P Hannifin, ago

Statistics do not determine probability

Well, that really depends on what probability you’re asking about. Perhaps it is more clear to say: The statistics of past events do not determine the probability of future events.

(At least not in and of themselves.)

An obvious example: Suppose you flip a coin three times. Your statistics, especially with the sample set being so low (and odd for that matter), naturally won’t reflect the intuitive 50/50 probability of flipping heads the fourth time.

What if you flip a coin 10 times and get heads each time? Does flipping 10 heads in a row imply anything at all about probability of flipping heads on your eleventh flip? (The answer is no.)

I bring this up because it’s annoyingly astounding how many times people will bring up statistics as evidence of societal privilege, oppression, or institutional racism / sexism.

For example, one may find that at a certain company, only 5% of the employees are black, and 95% are white. Does this mean a black person picked from the general population at random is far less likely than a white person to get a job there? Of course not. Firstly, that statistics of who’s already been hired doesn’t tell us anything about applicants who weren’t hired (are less black people applying in the first place?), and secondly, we’re ignoring quite a lot of other variables, such as interest in what the company does and necessary qualifications.

To make the fallacy a little more obvious: Suppose the company has 100 employees, 5 of which are black (thus 5%). Then a white person retires and they hire a black person in his place. Does this mean the probability of any random black person getting a job there just rose by 1%? That is, does hiring a black person increase the probability of any random black person being hired? Obviously not. (At least, I hope it’s obvious.)

And yet this fallacious way of interpreting statistics is brought up again and again in discussions of race and sex and privilege, as though the statistics of past events alone somehow determine the likelihood of your future. (“You have so many opportunities! Just look at the stats!”)

What’s even sadder is that this way of thinking seems persuade amiable people to believe that they have some kind of moral obligation to put themselves down based on their race or sex for the greater good, as in: “I shouldn’t apply for that job because I have white male privilege; that job should really go to a minority who doesn’t share my privilege!” or “I shouldn’t seek financial aid for my white children because they already have so many opportunities already just by virtue of being white!”

You don’t make the world better with that sort of thinking. You make it worse.

By S P Hannifin, ago

Font rendering: stb oversampling vs NV path rendering

I told you I wanted to try stb oversampling in my last post, and I did! Here is the result (stb 2×2 oversampling on top, nanovg in middle (which is based on stb anyway, but no oversampling), and NV path rendering on bottom, screen size then 5x zoom):

So stb oversampling definitely looks the best, although it is still pretty fuzzy. And moving it around by subpixels looks very decent; it doesn’t get very much of the “shimmer” effect. (Still a bit, but not much to be bothersome.)

Here’s stb oversampling (top) vs NV path rendering (bottom) with a bigger font size (screen size then 2x zoom):

Here, I think NV path rendering looks better; it’s definitely less fuzzy. (The trade-off is that it does suffer from more “shimmer” when translated by subpixels, but it doesn’t bother me too much.)

You can also see that NV path rendering is able to utilize proper kerning: the ‘e’ is slightly below the capital ‘T’, as it should be. Each letter isn’t being drawn on a textured quad, so overlapping is trivial. (Well, for the end library user, at least.)

So, I think that completes my foray into font rendering for now. I’m too lazy to make bitmap fonts at the moment; stb oversampling will work for smaller fonts for now. Time to continue on to other GUI elements. I will try to design the GUI system in such a way that it will be able to utilize any font rendering system should I wish to create bitmap font support in the future.

By S P Hannifin, ago

More font fun and other random stuff

Font rendering in OpenGL

Haven’t done so much programming in the past week, but I did try rendering fonts with NanoVG (in lwjgl). Unfortunately it’s really not much better than just using OpenGL’s NV path rendering extension. Small fonts look slightly better, but not really good enough for me to want to use them. See the example below, a zoom-in of an 8-pixel high rendering of the font “Verdana”, NanoVG rendering it on top, NV path rendering below. NanoVG is better, but it’s still way too fuzzy to look any good.

So I might just use bitmap fonts for small text; I can’t see any alternative. (Bitmap fonts basically means loading in each letter as a pre-rendered picture and plopping it on the screen. The disadvantage is that they don’t look very good when resized or positioned between pixels, but they’ll at least be guaranteed to render small fonts clearly and crisply.) I’ll continue to use NV path rendering for larger fonts or fonts that need to be animated more dynamically or rendered with 3D perspective. I do want to try using oversampling with stb for small fonts before I move on from font rendering and further develop a GUI system; the demo doesn’t look too bad.

Kanopy film streaming service

I just realized our local library offers free access to the film streaming service Kanopy, and they’ve actually got a decent selection. Not the latest blockbusters, but some good foreign and classic cinema. (They’ve even got The Red Pill, the controversial anti-radical-feminist documentary which Netflix refuses to stream. (Though they did just recently finally add the DVD to their catalog.)) Since it’s free (for library card holders of participating library systems), we’re limited to 10 streams per month, but the streaming quality is decent. It’s not full HD (at least not on my PC), but it’s better than DVD quality. Interestingly they also allow you to embed videos. Here’s “Kumiko the Treasure Hunter”, which I really enjoyed (which I guess you won’t be able to see without an account, haha):

Interesting indeed!

Some metal music

Finally, I recently discovered the band Elvenking. I couldn’t quite get in to some of their older work, but their last album, released last year, is quite catchy. Disregarding the bizarre sense of fashion metal band members tend to share, this song is some power metal awesomeness:

I also came across the latest album from the symphonic metal band Leaves’ Eyes, and found it to be quite catchy as well. Love the use of choirs, the female lead’s operatic voice, and the cheesy fantasy lyrics. (I’m not a big fan of the growl singing, it sounds so gross and ugly and demonic, why is it so popular? It sounds so awful, so unmusical. Bah!)

OK, that’s all for now.

By S P Hannifin, ago