Question about glGenTextures
Members - Reputation: 138
Posted 04 December 2012 - 05:49 PM
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.
Members - Reputation: 432
Posted 04 December 2012 - 08:56 PM
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.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.
Crossbones+ - Reputation: 2687
Posted 04 December 2012 - 09:33 PM
I work on this stuff: C4 Engine | The 31st | Mathematics for 3D Game Programming and Computer Graphics | Game Engine Gems | OpenGEX
Kickstarter in progress for our Halloween FPS game, The 31st.