.png files....

Started by
15 comments, last by Morbo 19 years, 2 months ago
Quote:Original post by Shadowdancer
If you're using SDL_image, the whole thing gets ridiculously easy:

*** Source Snippet Removed ***

Note that this code doesn't check for the correct image format and stuff, but it should work out of the box for any RGBA image with suitable dimensions. I also have a loader that only uses libpng, but that's a whole other story.

ok thank you, i sould be able to handle it from here(hopfully :P ) thanks for all your help
Advertisement
*sigh* ok one more problem(i hope) i set my game up to use .png files, the code is all fine(not compiling errors) but when i run the program, it keeps giving errors saying it needs a .dll called "tiff.dll" and one for Jpeg and all this other stuff, is there anyway i can disable all the other filetypes so it doesnt ask for the .dlls? since i dont wanna have like 10 .dll files with my game :S
I'm afraid these are statically linked to SDL_Image, so there's nothing you can do short of recompiling SDL_Image. They're not huge, though, so including them shouldn't be a pain.
---Just trying to be helpful.Sebastian Beschkehttp://randomz.heim.at/
dang, ok well does anyone know were i can get the tiff.dll? i have all the others it asks for, but i cannot seem to find the correct tiff.dll, i have a differnt one but it gives the following error

The application or DLL tiff.dll is not a valid windows image, please check this agaisnt you installation diskette

well thanks alot everyone, youv been alot of help :D
I personally use my own code to load files. My favorite is the TGA format because it includes the alpha channel. I think PNG does too, but I don't know for sure. If you don't want to have to include dlls for other images, use your own code. NEHE has tutorials for TGA files and the PNG format should be on the net somewhere as well. To me it is easier to just make your own code and turn the texture into a class that has the loading code and the GL texture object as well.


Quote:Original post by kburkhart84
I personally use my own code to load files. My favorite is the TGA format because it includes the alpha channel. I think PNG does too, but I don't know for sure. If you don't want to have to include dlls for other images, use your own code. NEHE has tutorials for TGA files and the PNG format should be on the net somewhere as well. To me it is easier to just make your own code and turn the texture into a class that has the loading code and the GL texture object as well.
originally we were going to use TGA format, but the file sizes are to big, and we are going to have TONS of image files , and png seems to be the best for what we need
Quote:
Not entirely. OpenGL (as well as D3D) will not allow 3 component internal formats, but will expand them automatically to 4 components. So basically, if you specify GL_RGB as internal format, then OpenGL will override this choice by using GL_RGBA instead. You, as an API user, will usually not notice this. But you should keep it in mind when considering memory consumption: a 24bit RGB texture will take up exactly the same amount of memory on the video card as a 32bit RGBA texture, because of the automatic padding. So, if you're dealing with uncompressed colour textures, then try to make good use of the alpha channel, because it's going to be allocated no matter what you do. If you don't use it, then that space is wasted.


Where is this specified? I have to say my experience with this is quite the opposite. I recently did an optimization pass of a project, and was able to greatly reduce my memory use by loading opaque textures as RGB only, as well as converting some to a single channel (they were being used as alpha masks). Previously every texture had been loaded as RGBA. In this case, I was able to save about 90MB of runtime footprint with this change alone.

This topic is closed to new replies.

Advertisement