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 basically just loads a giant texture from a file calls glDeleteTextures and then loads it again, if I run this test program on OSX this process can run for hundreds of iterations with no problems (the most I ran it for was 1024 and this had no problems) but after about 14 iterations on windows I get a GLU_OUT_OF_MEMORY error. The texture I am loading over and over is a huge sky dome (4096 x 1024 and 4.9MB).
Here is the code I am running with comments for the non lisp inclined:
Test Program:
(with-glcontext (shared-opengl-view)
;;loop 1024 times
(dotimes (i 1024)
;; create a texture and return its texture name
(let ((texture (create-texture-from-file (truename "lui:resources;sky domes;DarkClouds.png"))))
;;Allocate two bytes to pass to glDeleteTextures
(ccl::rlet ((&texName :long))
;; put the texture string into our allocated bytes
(setf (ccl::%get-long &texName) texture)
;; Delete the textures?
(glDeleteTextures 1 &texName)))))
Create-texture-from-file (most of this method is made up of openGL calls so I think most openGL people should have a reasonable understanding of what's happening here but I can clarify anything thats confusing):
(defun CREATE-TEXTURE-FROM-FILE (Filename &key Verbose (Build-Mipmaps t) Repeat (Mag-Filter *Default-OpenGL-Texture-Magnification-Filter*) Forced-Depth) "
in: Filename {string},
&key Verbose {boolean}, Repeat
out: OpenGL-Texture-Name {int}, width, height, depth
Load the <Filename> texture inside the texture directory.
- Ideal file should be 32 bit ARGB compatible, e.g., .png with mask or 24 bit RGB
- 8 bit and 16 bit image will work too
- Image size must be 2^n x 2^m, at least 64 x 64
- This function mu