Tutorial 1 - Library InstallationIntroduction
This tutorial provides an example of how to download and
install the SDL and OSG libraries in a Linux environment.
The following link provides instruction for
installation in a Windows environment:
Windows install. Concepts
SDL and OSG Library Installation Preparation We describe the process of installing from source. However, you may want to install from the binary versions of the libraries because there are a lot of dependencies on other libraries. As a launching point from which we can perform the installs, we'll create a directory for our project called game_engine, in a directory of your choosing:
Next, we create a temporary installation directory to house our installation source packages.
Note that in the following examples, to perform the final step for installation of a library, a 'make install' is usually performed. This step can only be performed with root privileges. This step will fail if performed as a regular user and the corresponding library will not be integrated into the system's library. Thus a 'sudo' (or 'su') should be performed with the 'make install' step to temporarily change to root user. Installing the Source Packages We will first provide instructions for SDL, and then for OSG. SDL: We need 4 specific source packages for our SDL installation:
SDL Source - SDL core library Let's create a directory for SDL inside of our inst_sources folder:
Downloading The 4 files need to be downloaded into the SDL directory we just created. Alternatively, you could obtain these files with the command 'wget' in the following manner:
Compile/Install Sources Now that you have the source packages in the correct folder, you need to compile them and integrate them with your existing library folder. Note that the commands should be performed starting in the SDL folder. SDL Source:
SDL Image Library:
SDL Mixer:
SDL True Type Font:
Cleaning Up
Now that the SDL packages are installed,
you have the choice of cleaning up,
i.e., keeping the installation source files, or removing all of the source files.
If you choose to remove the source files, you should go to:
>/game_engine/inst_sources/SDL/ folder:
If you executed this command in the right place,
your SDL directory should now be empty, and cleanup is complete.
If you executed this command from the wrong directory, you
are probably wishing that you had never seen this tutorial!
OSG: For OSG, you need only download a single file. Like SDL, you might first create a base folder in which to place your source package. From the inst_sources folder:
Downloading We need to place the following file into the OSG directory we just created: or use the command 'wget' to obtain the file from within our OSG directory:
Compile/Install Source The commands should be performed starting in the OSG folder. Like SDL, we have to compile this package. We do so by running the following commands: Uzipping Package
Installing OpenThreads
Installing Producer
Installing OpenSceneGraph (Note: 'make' will likely take a long time to complete on most systems.)
Cleaning Up
Now that you have finished installing the OSG packages, you have the choice of
leaving the source installation files as they are, or remove (clean up) all source files.
If you choose to clean up, as before, while in
the <location>/game_engine/inst_sources/OSG/ folder:
If you executed this command in the right place, your OSG directory should now be empty, and cleanup is complete. In the future, if any updated packages are released for OSG, they may be placed here and installed in a similar fashion to those just installed. Generic Linux Installation Scripts
The following scripts will automate the process of installing the necessary
components to complete the tutorial sets found herein. Note that these scripts
may not work for everyone, they are provided only as a convenience for those
who are unable to manually install the packages. We cannot be held responsible for the
damage that may be caused to your system via the use of the following scripts.
Note that you will need
superuser privileges during some portions of these scripts. Run the scripts
in the order they are presented here. This may be accomplished by typing
'sh ./scriptname.sh'. Reference Links Other helpful links, such as the SDL and OSG home pages, can be found in the links section. Conclusion Hopefully at this point you've been successful in installing both SDL and OSG. If not, try repeating all of the steps from the beginning, it's easily possible to miss a step. At this point, you're ready to begin coding using the new libraries, which we will explain in the next tutorial. |