Skip to content

Commit 653466a

Browse files
fix bug with unnecessary framebuffer swapping
1 parent 8934a8b commit 653466a

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Flamui/Drawing/GlCanvas.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void DrawText(ReadOnlySpan<char> text, float x, float y)
4646
// Console.WriteLine($"{c}: {fontAtlas.Font.Ascent}: {glyphInfo.YOff}, {glyphInfo.AtlasHeight}, {glyphInfo.Height}");
4747
DrawGlyph(fontAtlas, glyphInfo, fontAtlas.GpuTexture, xCoord + glyphInfo.LeftSideBearing, y + fontAtlas.Font.Ascent + glyphInfo.YOff);
4848
xCoord += glyphInfo.AdvanceWidth;
49-
Console.WriteLine($"Metrics: {c}:{glyphInfo.AdvanceWidth}:{glyphInfo.LeftSideBearing}");
49+
// Console.WriteLine($"Metrics: {c}:{glyphInfo.AdvanceWidth}:{glyphInfo.LeftSideBearing}");
5050
}
5151
}
5252
//an

Flamui/FlamuiApp.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public void CreateWindow<TRootComponent>(string title, FlamuiWindowOptions? opti
4949
{
5050
Size = new Vector2D<int>(options.Width, options.Height),
5151
Title = title,
52-
Samples = 4
52+
Samples = 4,
53+
VSync = true,
54+
ShouldSwapAutomatically = false
5355
};
5456

5557
var window = Window.Create(o);

Flamui/UiWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ private void RenderToCanvas()
322322
if (!RenderContextAreSame(RenderContext, LastRenderContext))
323323
{
324324
RenderContext.Rerender(_renderer);
325+
Window.GLContext.SwapBuffers();
325326
}
326327

327328
LastRenderContext.Reset();

0 commit comments

Comments
 (0)