Tutorial 1a : First things first
 
Introduction

To successfully write a Glide application using Visual C++, there are a few simple things that we must first do. These are:

  • Install the Glide SDK.
  • Install the Glide runtime library.
  • Tell the compiler where the Glide header and library files are located.
  • Create a suitable project workspace.
  • Tell the Glide header files that we're using a Microsoft compiler.
  • Tell the compiler to load the Glide library file.
Install the Glide SDK

The Glide SDK, or Software Development Kit, contains all of the necessary files for developing a Glide application. As well as the Glide libraries and header files, it also has extensive documentation.

The full kit is split into three sections - the SDK itself (including documentation), diagnostics and a separate documentation package - and is available free of charge from the 3dfx web site.

Note: the paths given here are those used by the release from the 2nd of July 1998. If you are using a different version, the directory structure may be different.

Install the Glide runtime library

You probably have the Glide runtime library already installed on your machine, but if not you must do so before writing any programs. The library is what allows your programs to talk to the Voodoo card, and without it they will not work.

You can download the runtime library reference drivers from the 3dfx web site, or card-specific drivers should be available from your 3D card manufacturer's web site.

Tell the compiler where the Glide header and library files are located

We now need to let the compiler know where certain files are located. Go into Developer Studio and select the ToolsOptions menu item. Change to the Directories tab and make sure the "Show directories for" option is set to "Include files", as shown in Figure 1.


Figure 1 : The "Directories" tab of the "Options" window.

Click on the "new" button (dotted rectangle with a yellow spark) and then click on the "browse" button (three dots) that has appeared at the bottom of the directory list. In the directory window that pops up, find the directory where you installed the Glide SDK and then find the subdirectory:

    \3Dfx\SDK\Glide2x\Src\Include
Now double-click on that directory so that it appears in the "Directory name" box and then click the OK button. The compiler now knows to also look in that directory for include files, so it will be able to find the Glide headers.

Now change the "Show directories for" option to "Library files" and add a new directory in the same way as you did for the header files. The subdirectory you want to add this time is:

    \3Dfx\SDK\Glide2x\Src\Lib\Win32
Once that's done, click on OK in the Options window and it will close.

Note: we only need to specify these settings once, not for every new project.

Create a suitable project workspace

Select the FileNew menu item and then select "Project Workspace" from the list. The "New Project Workspace" window will open, as shown in Figure 2.


Figure 2 : The "New Project Workspace" window.

For the purposes of our first few tutorials, create a console application with the name tutor_1, or whatever name you would rather use. The "New Project Workspace" window will close when you click on OK, and the workspace will have been created, ready for us to start writing our program.

Tell the Glide header files that we're using a Microsoft compiler

The Glide header files behave slightly differently depending on what sort of compiler we're using. To tell them that we're using a Microsoft compiler, select the BuildSettings menu item and change to the "C / C++" tab, as shown in Figure 3.


Figure 3 : Changing the preprocessor definitions in the "Project Settings" window.

The "Preprocessor Definitions" text box will be set to:

    WIN32,_CONSOLE
which simply means that we're writing a Win32 console application. To let the Glide headers know that we're using a Microsoft compiler, you need to add the __MSC__ definition, separated by a comma, thus:
    WIN32,_CONSOLE,__MSC__
Please note that there are *two* underscores on either side of the "MSC".

Tell the compiler to load the Glide library file

We write a Glide program by calling several functions that have already been written for us. These functions are contained in the Glide library file, so we need to let the compiler know where it is. Because we've already specified the directory that contains the Glide library files, we only need to tell the compiler what the name of the file is.


Figure 4 : Adding the Glide library in the "Project Settings" window.

To do this, change to the "Link" tab in the "Project Settings" window, as shown in Figure 4. The "Object / Library modules" text box contains a list of all the library files that we want to have available to our program. Add the name of the Glide library file, "glide2x.lib", to the beginning of the list and then click the OK button.

We must also remember to include the Glide header files in any source files that need access to the library routines. Remember that the primary header file (the only one that we need to include, although it will include others itself) lives in one of our specified "Include files" directories, not in our project directory, so angle brackets should be used in the #include directive, thus:

  #include <glide.h>
Finished!

The compiler now knows where the Glide header and library files are and the header files know that we're using a Microsoft compiler. That's all there is to it! Our new project workspace is now ready for us to start writing some code.

Next Tutorial | Main Page
 


This tutorial is ©1998 by Andrew Smith. No part of this tutorial may be reproduced without permission. If you want to reproduce any of this tutorial for non-commercial purposes then I'm not likely to try and stop you, but please ask me first.