Skip to main content
GameDev.net gamedev.net
🔒 Locked

Max textures?

Started by NoteMe Nov 20, 2004 at 8:46 PM 6 replies 600+ views
Original Post
NoteMe
NoteMe
Is there a max number of textures or something you can have loaded at every time? I am using auxDIBImageLoad to load textures, and when I get passed 75, then some of them are blank. Do I have to unload some in between. I don't think memory is an issue. I have 1,2Gb of RAM. And the textures isn't that big. Or are they loaded onto the GPU? Well I have 128MP on my graphics card. ØØ
zix99
zix99
I'm pretty sure all the textures are uploaded to the GPU. Something you might want to think about is if you are using mipmaps, that will take up extra memmory (for instance if you use a 1024x1024 texture it also stores 512x512, 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2).. which can add up quickly.

As far as i know the only limit is the max value of an integer and video memory, although i could be wrong.

~zix~
NoteMe
NoteMe
I have 15,5Mb of textures. And yes I use MipMaps, but I have only 2 that is 512, eveyone else is rather small, but I have some that is not a potense of 2, so if I have one that is lets say 90*40, is that loaded as 128*128, and then it makes smaller textures of the same, then it might add up a bit more. Hmmm...maybe you are right. Wish it was an easy way to test if that was the case.


ØØ
_the_phantom_
_the_phantom_
as long as you can generate a texture ID for the texture then you can upload it, OpenGL will swap the textures between video ram and system ram as needed. Ofcourse, too many textures will degrade performance as more swaps are required.

Unless you use glu to upload and build mipmaps in one go or use an extension to allow non-power-of-two textures you MUST supply OpenGL with a power-of-two sized texure and you must provide it with all the mipmap levels if you are using them (the quickest way currently is to enable automatic mipmap generateion via the SGIS extension GL_SGIS_generate_mipmaps and then upload the base level image).

btw, as a side note, I'd consider dumping the aux library for something a bit more up to date (DevIL, Corona, FreeImage to name but 3).
nagromo
nagromo
Shouldn't OpenGL deal with swapping if that were the case? I thought that if you ran out of video memory it just had to 'thrash' them, which decreases performance.

I have no idea what's causing this, but I don't think it's limited video memory.

Do you resize them all to a power of two before uploading them to the graphics card?

[edit]Oops, beaten by the phantom.[/edit]
NoteMe
NoteMe
OK, so since I have so many non power of two generated bitmaps loaded, that might be the problem. OpenGL doesn't unload and load them automaticaly. DIdn't know that. Well this is my first go with OGL at all, and I am a couple of hours from finishing my first FPS game. So it would be stupid to throw away AUX right now. But I will remember those other extensions for next time, thats for sure.

But it is kin of weird anyway, because my texture loading function has a lot of error testing, and it returns true even if I get that white texture some times.

If it was a propper project I wouldn't have used so many textures for stupid things anyway. It is just a trial and error project for me. I am actualy a DX guy.


Thanks
ØØ
silvermace
silvermace
avoid the AUX library, it has some 36 memory leaks and hasnt been updated or supported for nearly 10 years now, change out the code!! :)
NoteMe
NoteMe
Hehe...okay okay okay...:)....I found out that it can't be the RAM, because I started to load TGA files instead. And now I have much more textures, and it still works. But now I am doing it more manualy. Then change the order of bits, and change it to an OGL texture. Will have a look at the other libraries as soon as possible. But it is hard to find good documentation on it. I tried to look for some examples on DevIL the other day. Didn't look much, but I couldn't find much useful stuff. But read in one of the stickies here that there maybe will be soon. Looking forward to that.


ØØ

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.