Gdip Recycle Polygons Topic is solved
Gdip Recycle Polygons
I have a program, https://github.com/Murat65536/AutoHotkey-3D-Rendering-Engine, which attempts to simulate a 3d-rendering engine using AutoHotkey. I seem to have many issues with this as I am just beginning to learn the language but one of the largest ones is that it is consuming TONS of memory before just blacking out. I think this is a result of the polygons being drawn but when the pBitmap and G are deleted, not being removed themselves. How would I fix this? Is there a way to reuse these polygons to cut down on memory?
Re: Gdip Recycle Polygons Topic is solved
Hi,
At the end of each call of the Polygon() function a new GDI bitmap object is created and its handle is stored in hBitmap without deleting a previously stored object. Polygon() is called from DrawWall() which is called many times from Draw3D() where only the last created bitmap object will be selected into Canvas. All other objects stay in memory until the script terminates. The GDI object should be created only once in Draw3D() directly before the call of SetImage().
At the end of each call of the Polygon() function a new GDI bitmap object is created and its handle is stored in hBitmap without deleting a previously stored object. Polygon() is called from DrawWall() which is called many times from Draw3D() where only the last created bitmap object will be selected into Canvas. All other objects stay in memory until the script terminates. The GDI object should be created only once in Draw3D() directly before the call of SetImage().
Re: Gdip Recycle Polygons
Thank you. I couldn't find why this issue was occurring and this has helped a LOT. It still has many issues such as the faces not being rendered correctly, causing some overlap but I'll try to work on it. I'm still quite new to this, so are there any changes for performance/readability that I should look at?
Who is online
Users browsing this forum: Draken, Feder, st-webmas, WarlordAkamu67 and 26 guests