Gdip Recycle Polygons Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
bob65536
Posts: 9
Joined: 18 May 2024, 09:50
Contact:

Gdip Recycle Polygons

26 May 2024, 10:45

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?
just me
Posts: 9579
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Gdip Recycle Polygons  Topic is solved

27 May 2024, 02:43

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().
bob65536
Posts: 9
Joined: 18 May 2024, 09:50
Contact:

Re: Gdip Recycle Polygons

27 May 2024, 10:33

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?

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Draken, Vgtrd and 29 guests