| DemoGL::About::I/O support |
To set the source of all the files the application will load, use DEMOGL_SetVariable to set the variable DGL_VF_FILESRC to either DGL_FSRC_LOADFROMDATAFILE to read from a datafile or DGL_FSRC_LOADFROMDIR to read from a directory. Use the DGL_VF_SRCDIR variable to set the name (i.e. the full path if the directory is not located in the directory where the application is located) of the directory and DGL_VF_DATAFILENAME to set the name of the datafile, including the full path, if the datafile is not located in the same directory as the application. Be aware of the fact that DemoGL needs to know the source of all the files before application execution starts (i.e. when DEMOGL_AppRun is called). DemoGL expects the systex directory and the application script in the root of the datafile, when loading from a datafile or in the directory itself when loading from a directory.
After the source for all the files is set and application execution is started, files can be loaded. DemoGL supports special purpose loading functions to load data automatically into internal structures (texturedata, sound elements) and a normal filedata loading function (binary data). For sound elements a developer can use TLE's or the API function DEMOGL_SoundSystemLoadElement to load a sound element into the soundsystem. To load a sound element by using a TLE in the script, see _SOUNDSYSTEM syntax for more details. For texture data, DemoGL provides special purpose API functions to load jpeg, bmp and tga data and to convert the contents of these files into RGBA8 bitmaps which are stored as textures in the texturestore inside DemoGL. Use DEMOGL_TextureLoad to load a jpeg, bmp or tga stored bitmap straight into a texture object inside DemoGL. For loading binary data into your application (for example to decode PNG or RAW textures into RGBA8 bitmaps) DemoGL provides the DEMOGL_FileLoad function.
All loading functionality in DemoGL has logic to free the loaded data. Allthough DemoGL cleans up everything that is loaded when the application is closed, it's recommended to free any loaded data when that data is not used anymore.
Last changed on 11-mar-2001
©1999-2001 Solutions Design