Page 1 of 2

Using an existent device (OpenGL)

Posted: 07 Jan 2020, 02:42
by igorsegalla
Hello,
I am trying to integrate NoesisGUI with Urho3D game engine, but I dont understand how I can get the renderer device already created by Urho3D, into NoesisGUI.

I need to implement by myself the Noesis::RenderDevice, Noesis::Texture, Noesis::RenderTarget interface? Or I can simply set a OpenGL device (I am using OpenGL on Urho3D) at some NoesisGUI part and it's done?

Im really confused about it, consdering I will not use the NsApp on my implementation source.
Thanks.

Re: Using an existent device (OpenGL)

Posted: 07 Jan 2020, 13:00
by jsantos
This is a minimal sample without App library and using an external context created by GLUT:

https://github.com/Noesis/Tutorials/tre ... rationGLUT

It is using our reference GLRenderDevice implementation.

Re: Using an existent device (OpenGL)

Posted: 07 Jan 2020, 23:31
by igorsegalla
Cool. I managed to implement into my game, but the background is always black.
Image

Should be rendered on top of this screen, but isn't:
Image

Do you know why? Im calling view->render at Graphics::EndFrame (Urho3D), I tried to use glPushAttrib( GL_ALL_ATTRIB_BITS ); too, but doesnt work.
Thanks.

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 15:14
by jsantos
That XAML is probably setting the background to black. Could you please paste it here?

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 16:50
by igorsegalla
 <Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
            <Viewbox>
                <StackPanel Margin="50">
                    <Button Content="Hello World!" Margin="0,30,0,0"/>
                    <Rectangle Height="5" Margin="-10,20,-10,0">
                        <Rectangle.Fill>
                            <RadialGradientBrush>
                                <GradientStop Offset="0" Color="#40000000"/>
                                <GradientStop Offset="1" Color="#00000000"/>
                            </RadialGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                </StackPanel>
            </Viewbox>
        </Grid>
Dont have background defined on XAML, so I guess xaml layout isnt the problem.

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 18:00
by jsantos
Could you use RenderDoc to analyze API calls? There must be a clear to black somewhere and I am quite confident it is not Noesis. 😀

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 18:48
by igorsegalla
Hmm its weird cuz removing view->Render is normal, so must have some Clear into view->Render.
The order of RenderOfScreen matters?

ll debug with RenderDoc.

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 18:59
by jsantos
Yes, order of offscreen is very important. It must be done before binding the main render target. The offscreen phase may also bind an internal framebuffer, make sure to rebind your main buffer again.

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 19:08
by igorsegalla
When I call _view->GetRenderer()->UpdateRenderTree();, is bugging the Vertex Shader input. For this nothing is being drawn on screen...

Image

Re: Using an existent device (OpenGL)

Posted: 08 Jan 2020, 19:12
by jsantos
Render and RenderOffscreen do change GL state, you need to restore it accordingly to your needs.