GLWpfControl
GLWpfControl copied to clipboard
How to Use SwapBuffers in this Control?
I know there is a SwapBuffers() function in GLControl, is there also SwapBuffers() function in your control? and how should we use it? thanks.
I +1 this question. Even with RenderContinuously
set to true in the GLWpfControlSettings
, the control still only renders if something causes the layout to change (i.e resizing the Grid column/row containing the control). For my purposes, I would like it to be continuously rendering, and if possible, at a frequency I can define somewhere. Is this possible?
This might be done by settong an IGraphicsContext
in the GLWpfControlSettings.ContextToUse
but I'm not sure how to create one
Did anyone find a solution for this by now? I need this SwapBuffer, too.
Initially I came here because some tutorials mentioned the SwapBuffer thingy. But in my case it turned out I don't "need" it. I can render fine without swapping buffers. Might not be the fastest way, but it's enough for me right now
In case you're interested, here's my code:
https://github.com/adras/Zero-K-MapEditing/blob/main/MapCreationTool/MapCreationTool/Controls/TerrainControl.xaml https://github.com/adras/Zero-K-MapEditing/blob/main/MapCreationTool/MapCreationTool/Controls/TerrainControl.xaml.cs https://github.com/adras/Zero-K-MapEditing/blob/main/MapCreationTool/MapCreationTool/Terrain/TerrainRenderer.cs
There is no SwapBuffers()
function as this control is rendering using a D3D swapchain.
I'm not sure if it's possible to trigger a swap in the D3D swapchain directly, but I think wpf manages the compositing and swapchain pretty tightly so it might be pretty difficult.
I asked this question because I was having issues with render synchronization, and I need to take a snapshot after a render call. But soon after I asked the question, I took a snapshot using render to file, so I could ignore the render sync issue with this control, but I had to solve the render sync issue in OpenGL. and finaly I used GL.Finish() API to solve it. Hope can be helpful.