zaafar / ClickableTransparentOverlay

A library for creating transparent overlay using windows API & ImGui.NET
Apache License 2.0
87 stars 33 forks source link

AccessViolationException when create texture when height and width is not same size #38

Closed rafadsm closed 1 year ago

rafadsm commented 1 year ago

When i load image 512x512 128x128, ... or some size when width and height is same size, it works nice, but if i load image with width and height different, i get the error, a exmple: 512x128 The error is in ClickableTransparentOverlay.ImGuiRenderer.CreateImageTexture when the method calls the device.CreateTexture2D(...) The error message is System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

The problem is in https://github.com/zaafar/ClickableTransparentOverlay/blob/49a3011d7f2ff514489fadf559741ae5355a7d71/ClickableTransparentOverlay/ImGuiRenderer.cs#L213

Looking to the Texture2DDescription, the parameters is format, width, height, ....., in the current code, using image.Width in height param