tongkuisu
Topic Author
Posts: 12
Joined: 17 Jun 2021, 10:09

Set my own xamlprovider

13 Jan 2022, 10:10

HI I'm integrating it to O3DE, I set my own xamlprovider, it works well when
Noesis::GUI::LoadApplicationResources("Theme/NoesisTheme.DarkBlue.xaml");
. it will call "loadxaml" in my own provider.
For this situation
Noesis::Ptr<Noesis::Grid> xaml = Noesis::GUI::LoadXaml<Noesis::Grid>("Test.xaml");
, it didn't call my override function, how to load xaml so that it can call my provider?THX
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: Set my own xamlprovider

13 Jan 2022, 17:39

Noesis::GUI::LoadXaml should invoke your LoadXaml implementation if the provider is correctly installed.

All our examples use custom XamlProviders, could you please have a look at them?
 
tongkuisu
Topic Author
Posts: 12
Joined: 17 Jun 2021, 10:09

Re: Set my own xamlprovider

14 Jan 2022, 02:46

thx, in fact I have tried your local provider, such as LocalXamlProvider and LocalTextureProvider, It works well for the pure xaml,
but for the xaml reference a .jpg, the texture seems didn't get a proper result, Eg, i want to show an image, no matter what image I use,
the render always as below, in fact, the texture width and height is right, seems the LocalTextureProvider can read the .jpg, but the result is not right
Image
do I have to set my own provider?
Attachments
Test.png
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: Set my own xamlprovider

17 Jan 2022, 11:43

You always need a Texture provider for loading images. This seems to be a problem with the integration or with the renderer implementation. I recommend using RenderDoc for this kind of errors. Also comparing with any of our examples using images, like DataBinding or Inventory.
 
tongkuisu
Topic Author
Posts: 12
Joined: 17 Jun 2021, 10:09

Re: Set my own xamlprovider

19 Jan 2022, 05:54

thx, I have fixed this using renderdoc, now everything works well except the glphys.
Here is a simple test
企业微信截图_1642564041939.png
I use renderdoc and find that the input texture is below, not like a sdf texture, and the texturesize is 0 (batch.vertexUniforms[1]), I use SetGlyphCacheWidth to set it 1024, so I think texturesize should be 1024.
企业微信截图_16425630727140.png
Here is my config, I didn't implement FNoesisFontProvider(implemented xamlprovider and textureprovider), I think it can use default font, corret me if I'm wrong, anything else I miss?
        NoesisXamlProvider = *new FNoesisXamlProvider();
        NoesisTextureProvider = *new FNoesisTextureProvider();
       //NoesisFontProvider = *new FNoesisFontProvider();  

        // Resource Providers
        Noesis::GUI::SetXamlProvider(NoesisXamlProvider);
        //Noesis::GUI::SetFontProvider(NoesisFontProvider);
        Noesis::GUI::SetTextureProvider(NoesisTextureProvider);

        // Set fall back fonts and default font properties
        const char* fonts[] = { "Fonts/#PT Root UI", "Arial", "Segoe UI Emoji" };
        Noesis::GUI::SetFontFallbacks(fonts, 3);
        Noesis::GUI::SetFontDefaultProperties(15.0f, Noesis::FontWeight_Normal, Noesis::FontStretch_Normal, Noesis::FontStyle_Normal);

        // Set application resources
        Noesis::GUI::LoadApplicationResources("Theme/NoesisTheme.DarkBlue.xaml");
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: Set my own xamlprovider

19 Jan 2022, 12:36

For debugging this kind of issues I recommend testing against our implementation (D3D11 for example). Just take a minimal XAML, open it with XamlPlayer and take a RenderDoc capture. Now, use the same XAML in your implementation, take another RenderDoc capture and compare both.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests