Skip to content

efliks/nostalgic-glide-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glide demo

Spinning 3D objects using the 3Dfx Glide library under MS-DOS.

I drew inspiration from PCRetroTech who made two videos (#1, and #2) documenting his challenges with Glide programming. The code is based on some recycled code of mine from the early 2000s, so don't expect master level engineering. The idea is just to put some pixels on the screen.

Apart from being a hobby, this project can be used for testing Voodoo cards under MS-DOS, because it fits into one floppy disk.

Prerequisites

The Watcom compiler suite is already bundled with the DOS/4GW extender.

Download and unpack the 3Dfx developer's kit. Do not install it as we only need particular files. Copy the following header files like so:

Glide/Src/SST1/include/*.h -> glide/include

And the Glide library:

Glide/Lib/DOS/Stack/glide2x.lib -> glide/lib

Copy the TexUS utility program that is needed for converting textures into 3Dfx's 3DF format:

Glide/Bin/DOS/texus.exe -> assets/textures

Finally, download and unpack the texture pack in the assets/textures directory.

The choice of the glide2x.ovl driver depends on the type of the Voodoo board that you have. A driver for Voodoo will not work with a Voodoo 2 board, and will crash the system. Put the OVL file in the same directory as the program executable. None of the official drivers seem to work with 86Box's emulated hardware, and always make the emulator crash. For 86Box, use the file included in the repository.

Build

Three targets are available:

  • 16-bit DOS + software VGA13h rasterizer (use makefile)
  • 32-bit DOS/4GW + software VGA13h rasterizer (use makefile.386)
  • 32-bit DOS/4GW + 3Dfx Glide 2.2 rasterizer (use makefile.gl)

The software targets exist as fallback and a reference for the Glide target. In order to compile any of the targets, simply use, for example:

C:\GLDDEMO > wmake -f makefile.gl

ATTENTION! For the Glide target, run prepare.bat first, then run wmake. This is a workaround for the fact that there are too many command line options for the wcc386 compiler.

You can use DOSBox to compile all targets, but it may be that you will only be able to run the software rasterizer, because of missing 3Dfx emulation. I am not familiar with versions of DOSBox other than the one I tested.

Textures

The two rasterizers read textures in different formats. These are legacy PCX used by the software rasterizer, and 3DF used by the Glide rasterizer. The 3DF textures have a size of 256x256, which is the maximum supported by Voodoo and Voodoo 2 boards.

To process the textures, use the included scripts process.sh and texus.bat. The texus.bat script should be run on the target MS-DOS system where texus.exe is installed.

Some objects in the demo use the Phong illumination model. A Phong lightmap is nothing but a special texture. This texture is included in the repository in assets/envmaps, and comes from one of my old projects.

Execute

After you have compiled the code and generated the textures, simply use:

C:\GLDDEMO > cubegl.exe

There are two objects in the demo, a texture mapped cube, and a Phong illuminated torus. Switch between them by pressing [space]. Use [escape] to quit the demo.

The software rasterizer cannot do Gouraud shading together with texture mapping, and does not use perspective correction.

Tested platforms & libraries

Emulators:

  • DOSBox 0.74-3
  • 86Box 4.1.1 (build 5634; config file included)

Physical system:

Library and overlay files (MD5 checksums):

  • glide2x.lib - 9bea7a7aa072576ba4d5c97245b44be6
  • glide2x.ovl - 50ea8e8ea6d4921cb9924680b080023f (for Voodoo 1 emulation in 86Box)
  • glide2x.ovl - 837e63598cdd0882e57944c505625256 (for Voodoo 2 on physical PC)

Header files (MD5 checksums):

  • 3dfx.h - a8bbbab4e4254406434a8a213abd99a2
  • fxdll.h - f6cd9a236299eec36e4a7b952bc35dea
  • fxglob.h - 995e85ea578b1df77ce8c68d76de5127
  • fxos.h - 29745e9d0e91bbedaf6158827a1f2ffa
  • glide.h - d95b73e67624ca3773a05dd07dab7287
  • glidesys.h - 6c89a25867b67a2ed3fcdc4811f2fa71
  • glideutl.h - 793b4b900ec61652fc85bd22748b57f9
  • sst1vid.h - 5e3fa9b0cabdf310f15ac1145221ab2f

Gallery

Cube image

Torus image

Releases

No releases published

Packages

No packages published

Languages