• Advertisement
Sign in to follow this  

Question about glGenTextures

This topic is 1872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

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.

Thanks,

xarg

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement