- HugoPeters
- Posts: 2
- Joined:
Off-screen elements (opacity < 100%) render incorrectly when resized
Hi,
I wasn't sure whether to submit this on the forum or as a bug, but it might very well be me doing something wrong, so here goes:
I've been integrating NoesisGUI into my own engine and I like it a lot, but I'm running into an issue where it seems the off-screen(?) render step doesn't take resizes into account.
As soon as there are transparent elements in the UI, resizing it messes up the entire widget.
Here's a video:
So what happens in the video:
- Widget with red (opaque) square works fine
- Adding another square, blue (80% opacity) messes up the resizing
The render implementation should be very straight forward, and looks like this:
The resize code is also pretty straight forward:
mNoesisView being a Noesis::Ptr<Noesis::IView> .
Also for reference, the XAML code used in the video:
Anything that I'm missing or might this be a bug?
This is on latest v2.2.1.
I wasn't sure whether to submit this on the forum or as a bug, but it might very well be me doing something wrong, so here goes:
I've been integrating NoesisGUI into my own engine and I like it a lot, but I'm running into an issue where it seems the off-screen(?) render step doesn't take resizes into account.
As soon as there are transparent elements in the UI, resizing it messes up the entire widget.
Here's a video:
So what happens in the video:
- Widget with red (opaque) square works fine
- Adding another square, blue (80% opacity) messes up the resizing
The render implementation should be very straight forward, and looks like this:
Code: Select all
bool NoesisViewRenderCallback::Render(Gfx_Context& aContext)
{
WAR_PROFILE_CATEGORY_SCOPE("NoesisGUI", C_Colors::Magenta);
IView* noesisView = mHandler->GetNoesisView();
{
WAR_PROFILE_SCOPE_NAMED("View Update");
noesisView->Update(mElapsedSeconds);
}
{
WAR_PROFILE_SCOPE_NAMED("UpdateRenderTree");
noesisView->GetRenderer()->UpdateRenderTree();
}
if (noesisView->GetRenderer()->NeedsOffscreen())
{
WAR_PROFILE_SCOPE_NAMED("RenderOffscreen");
aContext.GetRenderContext()->SetFrameBuffer(NULL);
noesisView->GetRenderer()->RenderOffscreen();
aContext.GetRenderContext()->SetFrameBuffer(aContext.GetRenderData().GetFBO());
}
{
WAR_PROFILE_SCOPE_NAMED("Render");
noesisView->GetRenderer()->Render();
}
return true;
}
Code: Select all
void NoesisViewHandler::OnViewResize(int aNewWidth, int aNewHeight)
{
if (mNoesisView)
{
mNoesisView->SetSize(uint32(aNewWidth), uint32(aNewHeight));
}
}
Also for reference, the XAML code used in the video:
Code: Select all
<UserControl x:Class="WarlockUI.SimpleDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WarlockUI"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="Black">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<Grid Height="100" Width="100" Background="Red">
<TextBlock TextWrapping="Wrap" Text="Opaque" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontFamily="Microsoft Yi Baiti"/>
</Grid>
<Grid Height="100" Width="100" Background="#FF0068FF" Margin="15.4,0,0,0" Opacity="0.8">
<TextBlock TextWrapping="Wrap" Text="Opacity 80%" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontFamily="Microsoft Yi Baiti"/>
</Grid>
</StackPanel>
</Grid>
</UserControl>
This is on latest v2.2.1.
Re: Off-screen elements (opacity < 100%) render incorrectly when resized
Are you restoring the viewport after the off-screen phase?
Re: Off-screen elements (opacity < 100%) render incorrectly when resized
What profiler is that by the way, is it a custom implementation? It looks cool 😊
- HugoPeters
- Posts: 2
- Joined:
Re: Off-screen elements (opacity < 100%) render incorrectly when resized
Ah.. yep that fixes it! Thanks!Are you restoring the viewport after the off-screen phase?
Looking back in the manual now I notice the little OpenGL sample, but perhaps some extra callout for dumb people like me would be nice :)
Haha thanks! I made it from scratch with dear imgui :)What profiler is that by the way, is it a custom implementation? It looks cool 😊
Who is online
Users browsing this forum: Bing [Bot] and 2 guests