Deleting image memory in OpenGL
My applications display very large jpeg aerial photos. When the user switches from one case to another (in the same instance of the app), I want to completely unload the aerial photo from the previous case.
After reading in the image and then loading the bits into video memory (using glTexImage2D()), I then delete all the memory that I allocated to temporarily store the bits (or scaled bits, if the dimensions were not a power of 2).
Before switching to a new case, I then call both glDeleteLists() and glDeleteTextures() with the ID of the aerial photo. I assume that this frees up the video memory that OpenGL was using to store the image.
However, the results that I see at runtime, imply that not all of the memory from the previous case has been deleted. Although I see no problem with the displayed aerial photo from the first case, the second case exhibits severe image problems, with several of the image tiles not being displayed at all. If I reverse the order of opening these cases, it is still the second case opened that has the problems.
GOT ANY IDEAS? PLEASE HELP!