glDeleteTextures does not seem to free up texture memory on Windows, is there no solution?

后端 未结 3 1765
忘掉有多难
忘掉有多难 2021-02-15 14:34

I have been having some problems with my openGL application running out of memory and I am trying to track down my problem. To this end, I created a small test program that bas

3条回答
  •  粉色の甜心
    2021-02-15 15:07

    Also, since your error has the GLU prefix, could you try running the same program without building mipmaps?[already done] I don't think GLU_OUT_OF_MEMORY necessarily means that you are out of GPU memory (in fact the mipmaps are probably built on the CPU), so maybe you are suffering from Heap fragmentation. The fact that you get the error on different Windows machines with very different GPUs seems to indicate that it's not a specific OpenGL driver problem; they are too different across vendors.

    Since you are using a large texture, and if not using gluBuild2DMipmaps doesn't solve the problem, you could pre-allocate the GPU memory for your large texture(s) once when your app starts and reuse the texture objects with glTexSubImage instead of creating new ones on reload.

    edit: the following does not provide a solution (see question comments), but is still useful in my opinion

    Since you get GLU_OUT_OF_MEMORY and not GL_OUT_OF_MEMORYI assume the problem occurs during mipmap creation with gluBuild2DMipmaps. Since maybe the glu function is at fault, perhaps you could try building your mipmaps in an offline process and then simply load them in Create-texture-from-file. Besides potentially solving your out of memory error, this would let you have much better control over the actual mipmap generation. You could for example use a gaussian filter instead of a box filter. It would also ensure identical mipmap content across platforms. My understanding is that this is how mipmaps are usually handled.

提交回复
热议问题