, , , , , , , , , , , , ,

Arkwood was prancing around with a mirror in his hand. ‘Why am I so handsome?’ said the spotty cretin.

‘Are you so handsome in a virtual world?’ I proposed.

So I created a mirror in Blender, the 3D creation suite:

And rendered it in my virtual world using OpenGL graphics library and the Oculus SDK for Windows. Arkwood put on the Oculus Rift virtual reality headset as I ran the C++ Visual Studio application. Here’s what he saw…

The mirror is over on the far wall, just next to the picture frame I created in my last post.

I told my chum to bump into the mirror, to trigger collision detection.

On collision, Arkwood has 3 seconds to say the phrase “mirror mirror on the wall”. The application uses Microsoft Speech API (SAPI) speech recognition to confirm the phrase, and then text-to-speech to reply through the computer speakers “you are the prettiest of them all”. SAPI runs in a thread so as not to block the main application from rendering to the Rift headset.

Here’s how we use SAPI to wait only 3 seconds for Arkwood to utter the phrase:

hr = WaitForMultipleObjects(1, handles, FALSE, 3000);
if (hr != S_OK) {

The last parameter is 3000 milliseconds. If the correct phrase is not recognised then the result does not equal S_OK and SAPI bails out.

All that is left to do is swap the blank glass texture within the mirror frame with a handsome picture of my buddy. Or not so handsome.

‘What the hell!’ Arkwood exploded. ‘The face in the mirror is ugly.’

Well, someone had to break the news to him. Doing it virtually is always the kindest way.



Here’s a video of the mirror in action: