Http://book.51cto.com/art/201104/255588.htm
1th chapter on the Bridge to OpenGL
This chapter is mainly for the future of OpenGL programming to do some groundwork work. The main content is: OpenGL component package installation, how to extract the useful information from the VC + + 6.0 OpenGL program, glut Library settings.
1.1 from C++builder 6.0 to OpenGL (1)
In fact, everyone uses the operating system Windows XP, Windows 2000 and development Environment C++builder 6.0 has already put this bridge in good condition. What we have to do now is to flatten the deck so that we can go more comfortably. All of our settings here are illustrated with the Windows XP operating system as an example.
A simple introduction to a component: TOPENGLB 6. This component was developed by Alan and used for background settings in OpenGL programming. You can now use this component for free (there's a very interesting story here that you can read later in this chapter). Readers can download it from http://www.hellix.com/Alan/Computing/for free.
Readers of the OpenGL book know that all OpenGL programs set a background and write each time:
- #include<gl/gl.h>
- #include<gl/glu.h>
You also set the screen color, size, aspect ratio, position in the window, and so on. and in VC + +, these settings require specific functions to implement. Well, now we can give this work to the TOPENGLB 6 components to do, to achieve the above mentioned effect only with the mouse to drag a bit.
Of course the reader can also use other more powerful component packages, but looking online did not find a component for the OpenGL aspect of C++builder 6.0 (for C++builder 4.0, C++builder 5.0). Of course, if readers are familiar with C++builder 6.0 and OpenGL, they can develop their own components that are best suited to their own use.
Use the TOPENGLB 6 package to lay the "bridge deck" below.
Given that the average person will install the application to the D drive, the following assumes that the C++builder 6.0 installation directory is D:\Program Files\borland\cbuilder 6. First, place the TOPENGLB 6 (all files containing the OpenGL Component Pack) folder in the Cbuilder 6 folder. Official commencement of work:
Open C++builder 6.0. In the menu bar, select components → install package command, as shown in 1-1.
|
(Click to view larger image) Figure 1-1 Outline of the component installation package |
When clicked, you will see the interface shown in 1-2 and click the Add button.
|
(Click to view larger image) Figure 1-2 installation process |
1-3, the dialog box here lets you select a component package file. Open the folder Topenglb 6, select the Openglpackage.bpl file, click on the "Open" button to do it.
|
(Click to view larger image) Figure 1-3 Select the installation package |
The interface shown in 1-4 will then appear. Let's look at the effect of what we did earlier. In the C++builder 6.0 palette, the last position has an extra helix tag. Click on it and you'll notice that an OpenGL component appears above it. And it's what we need, and all of the programs in the future use it to set the screen background.
|
(Click to view larger image) Figure 1-4 Helix label Add effect
|
1.1 from C++builder 6.0 to OpenGL (1)