OVERVIEW:This section of the tutorial shows you how to view the Resources of the sample texture project. In Windows programming, Resources are where information about creating objects such as windows, icons, menus, and buttons for your program are stored. With Imagine textures, the values set by the user on the Property Pages of the texture interface are stored in an array of float values. The name of this array is params[]. Property Pages are nothing more than a special type of dialog window, so it's settings are stored in the project's resource file.STEP ONE:![]() To view the resources for the texture, click on the Resource View tab of the Workspace browser on the left side of your screen. Click on the STEP TWO:![]() Double click on the "IDD_COLOR" label, the Color Property Page will be loaded into the edit window on the right side of your screen. The diagram to the left shows how the values of the Red, Green, and Blue components of each color button are stored in the params[] array. (The red text has been added to illustrate the variable names) Even though params[] is a float array, the Red, Green, and Blue components are integers in the range of 0 to 255. But, the Imagine rendering engine uses floating point color component values in the range of 0.0 to 1.0. So it is important to remember that before you use these values in your texture Work( ) function that you divide the value by 255 in order to normalize the value into the 0.0 to 1.0 range. We did this in the Quick Start Guide section of the tutorial to use the "Color 1" settings as our Checks color. Die-hard code optimizers will tell you that it is more efficient to do a multiply than a divide. So for better performance you may instead wish to multiply the color values by the reciprocal value of 255 which is 0.00392157![]() Here is how the values from the Controls Property Page are stored in the params[] array. ![]() Here is how the values from the Size Property Page are stored in the params[] array.
If you are wondering exactly where in the source code the params[] array actually gets used, its in the cpppages.cpp file. The function called CreatePages( ) loads the data values from the params[] array into the controls on the Property Pages. The StoreParams( ) function stores Property Page control data in the params[] array.![]() You can find class definitions and functions in your project very easily by using the Class Viewer. To go quickly to these two functions, click on the "Class Viewer" tab and expand the "Globals" folder. Here you will find a list of all the global functions in the texture sample project. Double clicking on a function name will load the source code file into the edit window and move to cursor to the beginning of that function. Next we will learn how to modify the Property Page Resources. Continue Tutorial Back to the Texture Tutorial Table of Contents. Back to the Tutorials |
|
© 2002 Kazimer Corp.
1010 University Ave. PMB #1862
San Diego, CA 92103-3395