Using OpenGL to Render Images (headless)

So this is something that I was searching for before and found when I wasn’t looking for it (why does that always seem to be a trend). This is an example program that will render a png (a simple triangle) using OpenGL and EGL on the command line without needing X11. Though now that I found it I can’t remember what it was that I wanted to render with OpenGL on the command line. Either way, great find.

https://github.com/matusnovak/rpi-opengl-without-x

DashGL Tutorials Season 2

So now that I”ve finally settled on a new design for Dashgl.com, the next step is to start making tutorials. I’ve been thinking about if I want to continue with GTK or if I want to switch to SDL. And while the original focus of using GTK was to provide more resources for making Linux applications, recently when looking at the options for making applications for different open source platforms, my first thoughts have been “i wonder if SDL will compile for this”. So I think with season two of tutorials, I’ll try switching to SDL as it will run on Linux as well as the GTK applications will, gives me more options for OpenGL versions, and I wasn’t taking advantage of the file menu or widgets anyways.

So as or approach I’ve been thinking that starting with the cube might be the best way to get adjusted. My previous difficulties with SDL was managing the input and the game loop, but I think I’ve found a sample for that, so it’s not as much f a problem as it was before. I think I can use the FreeGlut introduction as a way to get familiar with SDL in a way that doesn’t require any input from the user, as well as providing an avenue to test the matrix library that I was thinking about using before. It also allows me to follow up with OpenGL 1.0 on Brickout and then OpenGL 2.0 for Invaders and Astroids respectively. And then from there I can plan out more tutorials and do other testing.

So the next thing on the agenda is to follow the Freeglut book, make a new blog post for each chapter. And I have prior source to help me out in terms of fitting the pieces together. And then once all of the pieces are in place with the blog, then I can think of what I need to work on in terms of web site structure for the DashGL tutorials. Right now I’m thinking that the best way is to put the files in a static site generator, so that all of the html is a static html file, and nothing needs to run server-side to render the pages in advance once they’ve been generated. I think that gives me the easiest option for making clean looking links.

Console Wish List

I guess continuing with the trend of things I wish I had time to spend on more than my job, the next wish list is for consoles to play around with. I think we’re really fortunate to have a misunderstood generation of consoles prior to the PS4 and Nintendo Switch. It means that we have some really compelling hardware that is effectively now an open platform.

PS-Vita

The Ps-Vita is a great little system that I think ultimately suffered from some odd decisions on the part of Sony. I think they were really focused on trying to get into the casual game market that was taking off on phones, and that seems to have influenced a lot of design decisions around the user interface and the touch screen.

I think the idea must have been a hit in the board room, but the simple fact of the matter is that is people can already play casual games on their phones, why would they go out of their way to spend extra money on a dedicated gaming device with analog input. The answer is they won’t, and the extra features added to try to appeal to people who weren’t going to buy the device anyways, were passed on to people who wanted a simple gaming device.

And that led to the spiral of no one is buying the device, so no one wants to develop for the device because no-one is buying the device death spiral. But this isn’t a post mortem, why would I want a Ps-vita at the end of 2019 when Sony is no longer supporting it? And the answer is because Sony is no longer supporting it.

Stupid gimmicks like the touch screen and especially the back touch surface aside, now that the platform is dead and everyone is trading in their Ps-Vita’s, it means there are a ton of used Vitas being sold for cheap. And the fact that Sony is no longer supporting the device means that they won’t be releasing firmware to prevent custom firmware from being installed on the device.

So what specifically would I want to do with the device? It seems like it would be the best way to enjoy Playstation one and Play Station Portable games by grabbing a large format SD card and dumping a large library on there, with the advantage of having the Playstation controller button layout. Also a piece of homebrew that I’m hoping exists is to be able to use the Ps-Vita as a bluetooth controller. Nintendo was nice enough to make their controllers work with the direct input bluetooth standard but not Sony and their bluetooth controllers rarely ever work with anything, much less appear in discover mode.

One last pipe dream for the Vita is there is an SDK available. So it might be fun to try at least trying to get some hello world examples running on the system. And then see if something like SDL would work from there. If the Raspberry Pi had a killer handheld dev kit to work with, then I wouldn’t think about the Vita too much. But I do have the Odroid-Go. So I should probably get that put together and port brickout before i think too much about more hardware.

Vita Tv

The Vita Tv is next on the list but surprisingly for different reasons than the handheld Vita. One thing that I love about Nintendo’s philosophy is that games not specs makes a console. And I think the Gamecube and Wii are really good examples of this. Both of these consoles have pretty low specs but amazing games like Pikmin, Mario Sunshine and Wind Waker.

So I think the Vita TV comes surprisingly close to this philosophy by accident if by anything at all. Having a thin client 5w client with a bluetooth controller that can run post ps2 level handheld games seems like something I would really like. I think the above mentioned commitment to mobile gaming on the back touch pad, and UI ended up being a real detriment to the system, as something that came of as a more dedicated game device might have done better. I might have to see if there is some custom firmware option to change the user interface as the default UI option with the ios-like bubbles just looks stupid.

Wii or WiiU

The last two consoles on my random things I’d like to mess around wish list are the Wii and/or the WiiU. I haven’t seen enough of the WiiU to really know a lot about it. And the WiiU touch screen controller seems to add a lot to the price without really adding functionality that I really want.

I think for a wish list I’d like the option to emulate DS games with the controller and be able to play Gameube games with a Switch bluetooth controller. In general I want a Wii to throw a SD card into it and use it as a Gamecube and Wii library. But if the WiiU has the option to play Gamecube, Wii, DS and WiiU games, then I think I might go for that. Plus it has native HDMI out and better specs, along with games like Breath of the Wild.

So depending on if I can find a WiiU at a decent price, then it seems like it wuld be a fun system to buy and tinker around with to see what can be done with it. But in terms of priority I’d like to pick up a Vita and Vita TV before grabbing a WiiU.

Float Conversion

"readFloatLE" : function(offset, fixed) {

		var uint32 = this.readUInt32LE(offset);

		var negative = uint32 >> 31;
		var exponent = (uint32 >> 23) & 0xFF;
		var mantissa = uint32 & 0x007fffff;

		if(exponent === 0 && mantissa === 0) {
			return negative ? -0 : 0;
		} else if(exponent === 0xff && mantissa === 0) {
			return negative ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
		} else if(exponent === 0xff && mantissa !== 0) {
			return Number.NaN;
		}

		negative = negative ? -1 : 1;
		exponent -= 127;
		exponent = Math.pow(2, exponent);

		var man = 1.0;
		var shift = 0;

		for(let i = 22; i >= 0; i--) {
			
			shift++;
			if(mantissa & (1 << i)) {
				man += 1 / (1 << shift);
			}

		}
	
		var float = negative * exponent * man;

		if(fixed) {
			float = float.toFixed(fixed);
		}

		return float;

	},

Raspberry Pi Notes

PiBoy Color
3.2″ SPI TFT Screen
Raspberry Pi Zero
Raspberry Pi GPIO Header
16GB MicroSD Card
Micro-USB to USB Adapter
NES USB Controller

PiBoy Advance
3.5″ SPI TFT Screen HDMI
Raspberry Pi 2/3
32GB MicroSD Card
SNES USB Controller

PiStation Portable
3.5″ SPI IPS Screen
Raspberry Pi 3
32GB MicroSD Card
WiiU Classic Controller
WiiU Classic Controller Adapter

PiStation Portable
Raspberry Pi 3B+
64GB MSata
Element14 Desktop Case
800×480 UPerfect HDMI Screen
Logitech F310 Controller

Test Bench
Raspberry Pi Zero W
32GB Micro-SD
800×480 UPerfect IPS HDMI
8BitDo SnesPro Controller
Micro HDMI Adapter

Android Device
Galaxy S9 Black
DEX Dock
Bluetooth Keyboard
Bluetooth Mouse
Bluetooth Controller (xinput)
15″ 1080p

Top NES and GBC Games

Nintendo

1. Mario 1/3
2. Zelda 1/2
3. Castlevania 1/3
4. Metal Gear
5. Final Fantasy 1/2/3
6. Tetris
7. Megaman
8. TMNT 1/2/3
9. Ninja Gaiden 1/2
10. Metroid

Gameboy Color

1. Link’s Awakening
2. Oracle of Ages / Seasons
3. Pokemon Crystal
4. Shantae
5. Pokemon TGC
6. Megal Gear
7. Stranded Kids
8. R-Type DX
9. Dragon Warrior Monsters 1/2
10. Mario Tennis

Latte Panda Access Point

So the latte-panda has a built in antenna for wifi. Unfortunately I throw it away thinking that I wouldn’t need it. In terms of setting up a wifi access point, I think I can do it just fine with a usb wifi dongle, but it definitely adds more lights to something that seems to keep gaining more and more light sources. Having built in wifi and being able to use the onboard micro-sd card would have gone a long way to making a more sleek network host. I guess I’ll just have to keep going.

So for making an access point, I have two network devices. The ethernet enx00e04c367344, and wifi, wlan0. So I need to install and configure hostapd, install dnsmasq. Set up the wifi interface, and forward the traffic with iptables.

Mounting the Latte Panda

So something that’s kind of bullshit is the Debian installer wasn’t able to partition the onboard sd-card slot and mount /var for me during the installation. I figured that I could just mount the micro-sd card post install, except the micro-sd reader wasn’t seen at all by the operating system. So I ended up having to get a usb adapter for the micro-sd card. Kind of annoyed as if I wanted to use a USB drive for storage, I probably would have bought one. Storage is probably one of the wonky aspects of the first board, and by adding m.2 slots something they address in the latte panda alpha. I don’t have that kind of money which is why I’m using the old cheap one, but it’s still weird that this board doesn’t have a sata or m.2 sata slot, it would make the board a lot more functional.

So now that I have my micro-sd card mounted via usb like a pleb, the next step is to mount it on /var. So I need to copy everything in var to the sd card, add the micro-sd card to fstab, and then reboot and pray everything works.

$ sudo mount /dev/sda1 /mnt
$ sudo /bin/cp -arpx /var/* /mnt
$ sudo touch /mnt/sd.txt

Looks like I need the uuid to mount with fstab. I don’t think there should be too much problem posting the actual values for a local drive.

$ sudo blkid
/dev/mmcblk0: PTUUID="a7e4664a-ce38-4434-9c46-977861c882fa" PTTYPE="gpt"
/dev/mmcblk0p1: UUID="C07C-6F0D" TYPE="vfat" PARTUUID="62b5c747-0bcd-4662-b4e4-a0f673edfb53"
/dev/mmcblk0p2: UUID="5f141daa-1b45-49a0-97b1-629e9b81eaed" TYPE="ext4" PARTUUID="ab33c7b1-e45c-4e7d-a5b7-edc7fe87f9cb"
/dev/mmcblk0p3: UUID="c452f942-30d8-4d91-aa64-9541a0174257" TYPE="swap" PARTUUID="1e044fb1-40dd-4e15-a2ff-60b0118f5375"
/dev/sda1: UUID="526074a8-1ce7-4e30-a3df-2f693383ec78" TYPE="ext4" PARTUUID="17869b7d-01"

So I can probably copy the root mount (since it’s for ext4), and then use the same format, change the uuid and mount on /var.

#                
# / was on /dev/mmcblk0p2 during installation
UUID=5f141daa-1b45-49a0-97b1-629e9b81eaed /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/mmcblk0p1 during installation
UUID=C07C-6F0D  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/mmcblk0p3 during installation
UUID=c452f942-30d8-4d91-aa64-9541a0174257 none            swap    sw              0       0
UUID=526074a8-1ce7-4e30-a3df-2f693383ec78 /var               ext4    errors=remount-ro 0       1

Next step is to reboot and hope the the latte panda can actually reboot. This is a completely different side note, but the latte panda has three buttons. And I always have to mash random combinations of each button several times until it actually boots. So i’m hoping it will cooperate and reboot for me on the network, otherwise I might have to rethink this.

Edit:

It looks like the latte won’t boot without a button being pressed. That is pretty objectively terrible. Though after a successful reboot it looks like thr sd.txt file I made is there, so I’ll just try and avoid rebooting over the network, when possible. And continue to ponder the utility of using a micro-sd as a standard USB drive. In terms of price it’s probably the same thing as smaller drives generally end up being integrated micro-sd adapaters, hard drives make noise when reading from them, and sata-to-usb SSD’s are kind of in their own class of stupid. I’m mostly salty about not being able to use the on-board micro-sd card.