PDA

View Full Version : glTexImage2D can't free memory



hactieuho96
08-11-2017, 03:04 AM
After I run this function:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iWidth, iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)imageData);
My memory had increase about 2Mb and how can I free it???

This is my solution:
https://app.box.com/s/1l9t7if22w2bijei5shps5vh7ayndd74
(Run as VS2015, platform tool set v140, target platform version: 8.1)
_tmain function at NewTrainingFramework.cpp line 147, glTexImage2D function at NewTrainingFramework.cpp line 168
Thanks you very much!!!

mhagain
08-11-2017, 04:40 AM
glTexImage requires to allocate memory in order to store texture data, and because of OpenGL texture completeness rules and the way the old (mutable) texture specification API works textures cannot be validated until draw time, so the driver is more likely to use system memory as temporary storage until it can validate that the texture is complete and can be loaded to the GPU.

What you're seeing is therefore most likely normal and expected behaviour.