Texture Mapping

I was looking at the examples included with the source, and they use the AWT. Is there a way to use textures while staying away from AWT?

The way I’m doing it, and the way Cas does it, is to write a class that uses AWT to load images and convert them into a proprietary file format. Then you can ditch the converter class in your final distributable.

I could spam this topic with a bunch of source code, but you’d probably be better off just taking a look at how Cas does int SPGL. Look in the spgl-tools branch, I think it’s called something clever like ImageConverter.

Paul

So what you’re doing is using another class that you’ve (or CAS) has written that loads the image file using the AWT, and then converts it to your own format? And your program uses that new format when it’s run?

Yes.

Cas :slight_smile:

You could also write your own TGA loader. TGA is a standard file format supported by most paint programs. It is easy to write a loader and the format is very well documented. Look at http://www.wotsit.org/ under graphics files.

This way you can use a standard graphics file format without using awt or inventing your own format.

Happy coding!

That’s what I’ve done as well. I knocked up TGA, SGI/RGB and 24-bit BMP loaders. I think SGI/RGB was probably the easiest.

Half the fun of writing your own loaders is using paint applications to test your output code to see whether the spec is actually correct. Many times I’ve found things like pixel-formats being slightly different from reality. Fun for all the family!

Could you make these loaders available as a library, or are they specific to your project?

Kev

Hi Kev, sorry for the late reply.

Well, they’re not specific to my project in that I can pull them out with a couple of utility classes and they’ll stand alone, but they are specific in that they only handle what I need - all I can really say is that they work fine for what I use them for, and for files generated by the applications I use!

Ach, give them a go - if they’re not what you want, you can always get a good start on writing your own loaders from them. I’ve archived them up and written a little readme:

http://www.padcroft.org/cfmdobbie/files/simple_imaging.zip