Minizip – a small zip library

I’ve recently split my zip decoder off from Octet (and Vookoo) and it has a project of its own.

It lives here: https://github.com/andy-thomason/minizip

Minizip is a tiny modern C++ library for decoding zip files and other file formats containing the Deflate compression method such as PNG.

It is going to be used for the Zegami image library project in Oxford by my student David Babera and so should get some testing.

There are two classes at present:


minizip::decoder
minizip::zipfile_reader

The decoder class takes a block of deflate encoded data and produces raw bytes. The zipfile_reader class manages a mapped zip file and enables extraction of data in parallel from Zip files.

I may move my bzip2 decoder into this project also to avoid duplication of effort. Zip files can optionally include Bzip2 compressed data.

I will also write a microscopic version of an LZMA codec if I get the time.

This is a basic example of use:


#include <minizip/decoder.hpp>
#include <minizip/zipfile_reader.hpp>

int main() {
zipfile_reader reader(if_zip, if_zip + sizeof(if_zip));

// Get a list of file names.
auto names = reader.filenames();

// Read the first file using the name as a lookup
std::vector<uint8_t> text = reader.read(names[0]);
std::cout.write((const char*)text.data(), text.size());

// Get a list of directory entries.
auto entries = reader.dir_entries();

// Read the first file using the directory entry.
std::vector<uint8_t> text2 = reader.read_entry(entries[0]);
std::cout.write((const char*)text2.data(), text2.size());
}

Getting OpenGL to run on a headless server

Today I have been looking for methods of running OpenGL – and ultimately Vulkan – on a headless server so that we can do thin client experiments on Vookoo, our vulkan wrapper library.

There is an excellent article here: http://renderingpipeline.com/2012/05/windowless-opengl/ on the subject which gave me some basic clues about running GLX, the interface to OpenGL on Linux machines.

I did a few little experiments and discovered that it was quite easy to run OpenGL examples such as glxgears http://linux.die.net/man/1/glxgears from an SSH session provided you had a working X server running and knew the display name.


$ ssh me@myserver.com
$ export DISPLAY=:1 # note: you should check this variable on your xterm
$ glxgears

And you should have glxgears (from the mesa utils) running on your remote desktop.

Of course, we don’t want to actually do this as you can’t see the result unless you are in the room with the server, but it does enable us to create framebuffers on our server, render to them and pump the result to an android app or web page.

Thin clients are likely to become more popular as internet data rates improve. The old HTML-based web model is likely to migrate to web pages that are merely windows on dynamic server generated content.

Our goal this summer at Goldsmiths College is to create a sample thin client VR system that pumps 3D content to a smartphone or desktop app so that multiple users can play a game or enjoy a visual experience on a single server.

We hope to be applying thin client technology to molecular dynamics (Bioblox) and art (Mutator).