Menu Home

Month: February 2018

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.

Font programming fun

So I’ve started working on GUI elements for my little engine that could. My quick list of things I’d like to include in a GUI system:

  • ability to create a menu bar
  • ability to create windows / panels with drop shadows
  • ability to create scroll bars for window content
  • ability to create buttons and button animations (hover, click)
  • ability to create text boxes and text fields

I started working on text today, i.e., font rendering. The NV path rendering extension actually does a pretty good job with larger text:

It’s not so good with smaller text:

Look at that ugly subpixel rendering:

Bleh! So I’ll have to figure out something else for smaller fonts. I’ll probably look into the Java AWT package, or perhaps look into NanoVG, especially since it looks like lwjgl already has bindings for it. (Maybe it already has everything I want?)

MIDI animator version 2 wishlist…

As I blogged a couple months ago, one of my goals for 2018 is to program a very simple 3D engine. I’ve been wanting to program a simple adventure game for a few years now, but the 3D and 2D engines I’ve played around with just don’t have quite the features I want, so I’m attempting to create my own little game engine with the Lightweight Java Game Library¬†(lwjgl).

Here’s what I’ve got so far: I can render a textured box and some resolution independent vector graphics including true-type fonts, which can intersect with the box!

OK, so nothing special yet.

Anyway, another thing I’d like to create with lwjgl is a new version of my MIDI animator, using vector graphics (instead of custom shaders) to represent the MIDI notes. (On a side note, I’m using the OpenGL “NV path rendering” extension for vector graphics support, which was created by Nvidia. Does that mean it’ll only work on their GPUs? I don’t know.) This should easily allow many more possible note shapes to be created.

Here’s my current wishlist for “MIDI animator 2.0” (I should also come up with a more interesting name):

  • Should be able to run standalone (that is, users shouldn’t have to download and compile the code to use it)
  • A graphical user interface (GUI) that makes it easy to:
    • load MIDI files
    • change note styles / shapes / colors / animations
    • a scroll bar to make it easier to scroll through the MIDI
    • save files
  • Ability to add title / text animations (instead of having to do this in post)
  • Ability to change / animate background
  • Ability to load in an MP3 to sync with the visualization
  • Ability to add an MP3 visualization, such as one of those pulsing frequency bars or something
  • Ability to export a movie file automatically (if I can figure out how; I’ll save this for last)

Anything else I should include or look into?

So, yeah, this is probably what I’ll be working on in my free time for now. I’ll probably start working on a GUI system next as I’d need to do this for a future game anyway.

Hopefully I’ll get back to actually writing some new music afterwards.