🔒 Locked
cross compiling
Advertisement
Original Post
Does anybody know much about loading TGA's in OpenGL? When I very first started messing with this stuff I remember when using bitmaps every bitmap had to have dimensions of a power of two and I think they had to be square, also. So 64x64 and 128x128 and so on. But the game I'm working on now I've been doing on Slackware. I've been using TGA's. The dimensions haven't really mattered much, I don't know why. Sometimes for some reason the whole picture would be skewed but then I'd just shrink it by a pixel either horizontally or vertically and it would work. Now I compiled a version for windows and nothing works. It's looking like every TGA has to have dimensions of a power of 2 and be square. Anybody have any idea why windows is different from Linux? And is there a way to make the dimensions of your pictures not matter?
Quote:Yes, it's something you shouldn't be doing in the first place. The only reason to use them is the easiness of writing a reader yourself. You should be already using png, jpg or other formats, TGAs are rather obsolete right now.
Original post by icecubeflower
Does anybody know much about loading TGA's in OpenGL?
I personally don't raccomend them anymore!
Quote:It is still advisable to use power-of-two-dimensioned textures. I don't think GL ever required square textures (sure some implementations did require it back in '95 but those days are long gone).
Original post by icecubeflower
When I very first started messing with this stuff I remember when using bitmaps every bitmap had to have dimensions of a power of two and I think they had to be square, also. So 64x64 and 128x128 and so on.
Nowadays, even the cheapest and dumbest implementation will have support for non-square textures. Non-power-of-two is almost ok and pretty widespread (but I have been told it still has some issues on low-end).
Quote:Is Patrick still running the mill? Slack rocked!
Original post by icecubeflower
But the game I'm working on now I've been doing on Slackware.
Quote:This sounds just the opposite to me! ;)
Original post by icecubeflower
The dimensions haven't really mattered much, I don't know why. Sometimes for some reason the whole picture would be skewed but then I'd just shrink it by a pixel either horizontally or vertically and it would work.
Quote:No wonder it doesn't if it comes from the last century!
Original post by icecubeflower
Now I compiled a version for windows and nothing works.
Quote:My best bet is that you didn't install the drivers, you're running a VooDoo3 or you're screwing your pixel format for some reason. Supposing you have a 2-3 years old card, you should be able to do NPOTD and absolutely non-square.
Original post by icecubeflower
It's looking like every TGA has to have dimensions of a power of 2 and be square. Anybody have any idea why windows is different from Linux? And is there a way to make the dimensions of your pictures not matter?
Why is png or jpg better than TGA?
I know jpg files are smaller, TGA always ends up as monster-sized as a bitmap.
Wouldn't TGA or bitmap be faster than jpg though? I mean if you use jpg then OpenGL would have to uncompress it using whatever crazy compression algorithms jpg uses wouldn't it?
Yeah as far as I can tell Slackware still does rock. I never used it back in the day I got into Linux not very long ago. I gave up last time I tried creating a game in windows. But now I got my Slackware and KDevelop and I'm kicking ass. I find using SDL extremely easy compared to windows stuff.
I know jpg files are smaller, TGA always ends up as monster-sized as a bitmap.
Wouldn't TGA or bitmap be faster than jpg though? I mean if you use jpg then OpenGL would have to uncompress it using whatever crazy compression algorithms jpg uses wouldn't it?
Yeah as far as I can tell Slackware still does rock. I never used it back in the day I got into Linux not very long ago. I gave up last time I tried creating a game in windows. But now I got my Slackware and KDevelop and I'm kicking ass. I find using SDL extremely easy compared to windows stuff.
Quote:
Original post by icecubeflower
Wouldn't TGA or bitmap be faster than jpg though? I mean if you use jpg then OpenGL would have to uncompress it using whatever crazy compression algorithms jpg uses wouldn't it?
CPU cycles are so much cheaper than reading data from the harddrive that you will typically see a significant performance gain by loading compressed files and decompressing them in memory.
As to your original question, you really shouldn't be loading any image formats yourself. There are literally tens of libraries that load images of many formats, so there is no point reinventing the wheel. Since you are using C/C++ and OpenGL, you should probably take a look at SOIL (the Simple OpenGL Image Library).
Hey how do you guys do those little quote boxes? I know how to do the source tags but not those quote boxes.
So I guess if you're using SOIL you can throw whatever kind of image you want at it and you don't need to worry about it? I'll check it out. I don't want to add any more dependencies though. I want people to only need OpenGL and SDL. I guess SOIL probably compiles into the executable though.
Right now to get my game to work in windows people have to get the most recent SDL.dll and drop into the c:\Windows\System32 directory and that's already more of a pain in the ass than I wanted.
So I guess if you're using SOIL you can throw whatever kind of image you want at it and you don't need to worry about it? I'll check it out. I don't want to add any more dependencies though. I want people to only need OpenGL and SDL. I guess SOIL probably compiles into the executable though.
Right now to get my game to work in windows people have to get the most recent SDL.dll and drop into the c:\Windows\System32 directory and that's already more of a pain in the ass than I wanted.
Quote:
Original post by icecubeflower
Hey how do you guys do those little quote boxes? I know how to do the source tags but not those quote boxes.
You can use quote tags the same way as source tags, you can also click on the 'quote' button in right upper corner of the reply.
Quote:
So I guess if you're using SOIL you can throw whatever kind of image you want at it and you don't need to worry about it? I'll check it out. I don't want to add any more dependencies though. I want people to only need OpenGL and SDL. I guess SOIL probably compiles into the executable though.
In case of SDL you can use SDL_image (sub-)library.
Quote:
Right now to get my game to work in windows people have to get the most recent SDL.dll and drop into the c:\Windows\System32 directory and that's already more of a pain in the ass than I wanted.
That shouldn't be necessary (and copying anything to system32 is bad thing to do anyway), you should distribute the needed .dlls with your program, and the dynamic loader should be able to load them directly from your program directory.
Quote:
Original post by swiftcoder
As to your original question, you really shouldn't be loading any image formats yourself. There are literally tens of libraries that load images of many formats, so there is no point reinventing the wheel. Since you are using C/C++ and OpenGL.
I would also recommend checking out DevIL (AKA OpenIL) as another example. It has support for many different file formats. I have seen DevIL used in many commerical products. DevIL is fairly popular so you should not have much trouble finding examples of how to use the API.
DevIL Homepage @ SourceForge.Net
Happy coding :-)
Bill
Quote:
Original post by Billr17 Quote:
Original post by swiftcoder
As to your original question, you really shouldn't be loading any image formats yourself. There are literally tens of libraries that load images of many formats, so there is no point reinventing the wheel. Since you are using C/C++ and OpenGL.
I would also recommend checking out DevIL (AKA OpenIL) as another example. It has support for many different file formats. I have seen DevIL used in many commerical products. DevIL is fairly popular so you should not have much trouble finding examples of how to use the API.
DevIL Homepage @ SourceForge.Net
DevIL cannot be embedded in most programs (LGPL), is rarely updated, does not maintain binaries, and is absolute hell to setup on Macs, so I don't usually recommend it anymore.
SDL_image library? Never heard of it but that's probably what I'll use if I ever get rid of my home brewed TGA loader. Everything SDL works like magic.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement