Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Question about glGenTextures

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 xargon123   Members   

138
Like
0Likes
Like

Posted 04 December 2012 - 05:49 PM

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

#2 smasherprog   Members   

568
Like
2Likes
Like

Posted 04 December 2012 - 08:56 PM

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.

#3 Eric Lengyel   Members   

3410
Like
2Likes
Like

Posted 04 December 2012 - 09:33 PM

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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.