If I get the OpenGL manual chapter 9 correct, it's legal do it the following way. In the OpenGL init() method you generate all your Texture objects by doing something like:
1 2 3 4 5
| int[] tmpids = new int[1]; gl.glGenTextures(1, tmpids); int id = tmpids[0]; gl.glBindTexture(o.GL_TEXTURE_2D, id); gl.glTexImage2D(o.GL_TEXTURE_2D, ...); |
Later on in the display() method you then activate the wanted texture object before drawing a polygon
---
1 2 3
| gl.glEnable(o.GL_TEXTURE_2D); gl.glBindTexture(o.GL_TEXTURE_2D, id);
|
When the wanted texture object is already in the graphic card's V-RAM (resident), it's used, otherwhise its loaded from slow system RAM. For the latter to happen some other resident textures are being kicked (not deleted from the logical part, so their object id keeps intact). The manual mentioned that for this process typical implementations of OpenGL apply a least recently used (LRU) strategy to decide which texture objects to move out of the working set.
If the V-RAM is too small to hold all your textures residently, the game will go slow. You can't do anything expect to decrease the texture sizes (a typical option in game menues).
Of course, I could have mis-understood all what the manual said. :-)