How to emulate Mode 13h in a modern 3D renderer?

Posted by David Gouveia on Game Development See other posts from Game Development or by David Gouveia
Published on 2012-10-06T13:05:00Z Indexed on 2012/10/06 15:53 UTC
Read the original article Hit count: 283

Filed under:

I was indulging in nostalgia and remembered the first game I created, which used Mode 13h.

This mode was really simple to work with, since it was essentially just an array of bytes with an element for each pixel on the screen (using an indexed color scheme).

So I thought it might be fun to create something nowadays under these restrictions, but on modern hardware. The API could be as simple as:

public class Mode13h
{
    public byte[] VideoMemory = new byte[320 * 200];
    public Color[] Palette = new Color[256];
}

Now I'm wondering what would be the best way to get this data on the screen, using something like XNA / DirectX / OpenGL.

The only solution I could think of was to create a texture with the same size as the VideoMemory array, write the contents of VideoMemory to it every frame, then render that texture in a full screen quad with the correct aspect ratio and using point texture filtering for that retro look.

Is there a better way?

© Game Development or respective owner

Related posts about graphics