Texture Loader

hey does anyone know how to program a texture loader for the MAC OS X operating system. I am trying to load a file for my particle engine, but it doesn’t seem to work so far… If anyone could help, it would be wonderful! Thanx

glTexImageXD are typically used to upload textures, or use the subcopy version.

If you are asking about file importers, then try Devil
http://openil.sourceforge.net/links.php

and recompile for your needs.

V-man

On X, you will probably bump into some problems loading the file if you use fopen(). This, because you really cannot know the path to your application (it differs depending if you run it thru LaunchCFMApp, Project Builder, Finder or CodeWarrior), can be fixed by using Bundle Services. The following code gets the path to your bundle, and then you should…

char basePath [256];
#if defined(APPLE) | | defined(MACOSX)
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef url = CFBundleCopyBundleURL(mainBundle);
CFStringRef cfStr = CFURLCopyPath(url);
(const char *)basePath = CFStringGetCStringPtr(cfStr, CFStringGetSystemEncoding());
strcat (basePath, “…/”);
#endif

Then, if you want to use fopen to open “texture.tga”, you need to do this:

char filepath [512];
strcat (filepath, basePath);
strcat (filepath, “texture.tga”);
theFile = fopen (filepath, “r+”);

This procedure is enough to make anyone want to use File Services, and possibly even QuickTime.