Three-dimensional Text : Turbo C++
Here, we shall show you a program that displays some three-dimensional text in various orientations, various degrees of thickness as well as in various colours. As you might guess, this program has been created using Turbo C++ and uses BGI graphics. The various modules used for drawing and displaying the three-dimensional text in this program have been described below :
The two main modules of this program are _3DTextOutput() and Draw3DText().
a) _3DTextOutput() – This module is called directly by the main(). The whole process of generating and showing the three-dimensional text begins here. Here, various calculations are performed in order to determine the orientation, thickness and colour of a particular instance of the text to be displayed. After the required calculations are finished for a particular instance of the text, Draw3DText() is called to instantly display that text on the screen. After this, calculations are performed to determine the data regarding the next instance of the text.
The whole process continues several times until all the text has been successfully displayed on the screen. After the drawing process is complete, the function waits for user input. If the user presses the ESC key, the program quits; otherwise the control passes back to main(). The whole process goes on like this :
// Perform calculations
// Call Draw3DText to draw the text
// Perform calculations to draw the next instance of the text, back to the first step
// When everything has been drawn, wait for input from the user
b) Draw3DText() – This module is called by _3DTextOutput() for performing the actual drawing after the required values have been calculated. It receives the values sent by _3DTextOutput(), manipulates them and then uses them to display the three-dimensional text on the screen. When one instance of the text has been displayed properly on the screen, the control goes back to the calling function i.e. _3DTextOutput().
The whole process goes on like this :
// Perform the final calculations before drawing the text
// Display the text on screen
// When the current instance of the text has been displayed, return the control back to _3DTextOutput()
The output of this program has been displayed in the images below :
Click here to download the source code of this program.
If you liked this program, please let us know 🙂