| DemoGL::Using::Loading data into your effectclasses |
Besides loading a texture using DEMOGL_TextureLoad or loading a soundfile using a _SOUNDSYSTEM related TLE in the application script, you can load any file you like using DEMOGL_FileLoad. DEMOGL_FileLoad returns a pointer to the block of memory containing the filedata. The pointer is a pointer to an unsigned char or byte, so if the data in the file is of another type, first cast the pointer to that type.
To get the length of the file, use another function: DEMOGL_FileGetLength. This function will return the length in bytes of the file specified.
When you're done with the data you loaded from a file, it's wise to free up the memory the file occupies. Because DemoGL allocated the memory, only DemoGL can free the memory. Do this by calling DEMOGL_FileFree. Pass the pointer you received when calling DEMOGL_FileLoad to DEMOGL_FileFree and the memory is freed. When you loaded a texture using DEMOGL_TextureLoad, you should use the function DEMOGL_TextureDelete to free up the data of the texture plus remove it from the texture store inside DemoGL. To free sound elements loaded with TLE's or with API calls, use DEMOGL_SoundSystemFreeElement. So every loading functionality has its own freeing functionality.
Last changed on 02-jun-2001
©1999-2001 Solutions Design