Borland C++ and OpenGL

This guide is intended for those of you that want to run OpenGL under Win 2000/NT/XP. This is possible for most compilers, but I will describe in detail how you can do it with Borlands free compiler. For Visual studio, see for example this page: http://www.hackorama.com/opengl/.

Borland C++ compiler

Borland has a C++ compiler that you can download for free, see www.borland.com (there is also a trial version of the Enterprise development environment, but that one is limited). To download the compiler the first time, you need to create a user account.

Once you have downloaded and installed your compiler, you need to configure your system. See the link Supplementary information on the download page. There you will find a step-by-step instruction on how to set up your environment variables (PATH) and configuration files (bcc32.cfg, ilink32.cfg). After completing this you have a good C++ compiler installed on your system. To test it you can type bcc32 in a command prompt. If everything is installed properly, the compiler will display a list of compiler flags.

Setting up OpenGL

The headers gl.h and glu.h are delivered with the Borland compiler and the library files should be in your Windows installation. What you need to do now is to download GLUT and to import a few libraries. To download GLUT you visit www.opengl.org and download the header file and libraries (Direct link: glutdlls37beta.zip). Assuming that you installed the Borland compiler in the default location C:\Borland\BCC55\ and that Windows is installed in C:\WINDOWS\ you do the following:
  1. Unzip the GLUT zip-file into a temporary directory
  2. Copy glut.h to C:\Borland\BCC55\include\GL\
  3. Copy glut32.dll to C:\WINDOWS\System32\
  4. Import dll's to Borland lib's:
    1. Open a command prompt (Start->Programs->Accessories->Command prompt)
    2. Type: cd C:\Borland\BCC55\Lib\
    3. Type: implib glut32.lib C:\WINDOWS\System32\glut32.dll
    4. Type: implib glu32.lib C:\WINDOWS\System32\glu32.dll
    5. Type: implib opengl32.lib C:\WINDOWS\System32\opengl32.dll
    6. Type: implib winmm.lib C:\WINDOWS\System32\winmm.dll
Now you should be ready to go! To test your installation you can try to compile the robot example by downloading it and typing bcc32 robot.cpp glut32.lib glu32.lib opengl32.lib in a command prompt. The executable becomes robot.exe. If that works, everything should be OK. Besides the compiler, you have also installed Borland Make. You can use this to compile the code for assignment 4 by using the provided file Makefile_bcc32. Either you rename it to Makefile and just type make, or you specify the file by using make -f Makefile_bcc32. There is also a makefile_borland in the example code directory.

If you have any problems, or find any errors in the instruction, do not hesitate to ask me: erik@cb.uu.se.

Good luck!

Erik
Last modified: 17 May 2005.