I have a question about glGenTextures, which I use to create some 2D textures from 3D volumes as follows:
During my initialization, I have something as follows:
[source lang="cpp"]m_pXTexNames = new unsigned int[m_nXDim];glGenTextures(m_nXDim, m_pXTexNames);m_pYTexNames = new unsigned int[m_nYDim];glGenTextures(m_nYDim, m_pYTexNames);m_pZTexNames = new unsigned int[m_nZDim];glGenTextures(m_nZDim, m_pZTexNames);[/source]
And for each of these I use glTexImage2D to generate the texture with some data.
Now, my understanding is that when you use this the data resides on the GPU memory but I see the system RAM increasing quite a bit after these calls and they stay high till I deallocate the texture (I verified this using the windows task manager).
Is this normal? Have I misunderstood how this works? I can show more detailed code if you want.
All gentextures does it get you a valid Texture ID. It doesn't actually create a texture for you. So, you would Usually,
GenTexture //get an ID
BindTexture //sets the active texture for work
Fillorcreate the texture stuff here
GenTexture should only be called when you want a NEW texture ID. If you are just updating a texture, or want to bind it for work, use the ID that you got from your GenTexture call when you created the resource.
Wisdom is knowing when to shut up, so try it. --Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.
The GL driver also keeps a copy of the texture image in RAM. The contents of the VRAM accessible to the GPU can be dumped at any time (for example, if the screen resolution is changed), and the driver needs to be able to restore your textures from its copy in RAM without you having to do anything.