   what happens if video ram is full
  hello, i have a tile-based game where every tile has its own 128by128 texture.so on large maps this sums up to quite a lot of texture data.i am preloading textures during the game as the player moves around. now my question is, if i should also remove textures from VRAM if the player is far enough away from them.what exactly happens if the VRAM is full? will my textures still be available when i glBindTexture them?btw: does anyone know of a tool to watch the amount of VRAM? like the windows task manager?   
  The driver is responsible for handling the texture. If the video memory is full, then it simply has to find somewhere else to put it. Like the system memory, or it may even end up on the disk in the virtual memory if you're unlucky. Extreme case maybe. The driver maybe already have a copy in system memory and only puts the working set in the video memory, so texture may not end up in video memory right away.It is a good idea to remove unused textures, and could be a good idea to remove the ones you know for sure isn't going to be used in a near future. This depends on if loading them during runtime takes a noticable mount of time or not, as the game may freeze for short, but annoying, periods of time.But having one texture per tile sounds a bit strange. Sure you need that? Can't several tiles share texture? Otherwise you basically have one large texture for the entire map. Doesn't sound like a tile based map then.   ;  I assume if vram is full it goes onto the system ram and if thats full it goes on to the hard disk space or virtual memory and so on.   ;  When you tell OpenGL about a texture image (glTexImage etc), it only copies it to OpenGL system RAM. Then, when the texture is actually about to get used, the driver manages to update the texture into VRAM before it's used for rasterization. The driver manages video RAM, and the shuffling back and forth.However, if you have enough of the textures, system RAM may run short, too. I don't know whether OpenGL will actually let the system RAM page to the paging file, or whether it'll return an out of memory error (through glGetError()) at that point (glTexImage() would be the point). Paging to disk makes things pretty slow, anyway.In a large, roaming world, I would plan on dividing levels into cells, and loading  new cells into RAM from disk myself when the player comes close enough (and unload when he's far enough away).;  thank you all!   ;  Depending on your driver's implementation, it will page to primary RAM and then to hard disk. Some higher-performance drivers will not do this, but I know that at least one of the nvidia drivers for Linux does, and since they have unified drivers, I'd assume that also holds true for Windows.It's also a good idea to remove your old textures when you're done with them.   ;  In former days you could put your textures into display lists to keep them in vramToday its called resident texture set (see opengl redbook)   ;Quote:Original post by BasirorIn former days you could put your textures into display lists to keep them in vramToday its called resident texture set (see opengl redbook)You can request they be kept there, but drivers are free to do whatever they want.  Querying the if a texture is resident through glAreTexturesResident() doesn't work on all drivers.  When it isn't implemented the function says they are all resident, leaving you to other methods of determining if they are present.There are various ways to determine if the drivers support the function, I'll let you search for those because you will learn a lot in the process.   ;  I just read on gamedev and YannL said that glAreTexturesResident was obsolete and would return grabage if you used it... I was going to look at using this also, but after reading this I dropped it.linkhttp://www.gamedev.net/community/forums/topic.asp?topic_id=371919;Quote:Original post by MARS_999I just read on gamedev and YannL said that glAreTexturesResident was obsolete and would return grabage if you used it... I was going to look at using this also, but after reading this I dropped it.linkhttp://www.gamedev.net/community/forums/topic.asp?topic_id=371919Quite often the returned value does actually mean something.However the function is obsolete and fairly useles since you cant trust that the driver has even implemented it and when it has then the value you get is driver dependant anyway so its not portable.You can rely on the driver to manage video memory for you quite effectively and trust it to make the best decisions.If however you know that you wont be using a texture for a long while then its best to remove it from memory to free up space and so that textures you do need are more likely to be resident when you need them.   