TasmanianNoob
Topic Author
Posts: 5
Joined: 15 Nov 2022, 03:38

BGFX Noesis Implementation not working

09 Nov 2023, 13:02

Hello, hopefully this isn't the wrong place to put this thread.

I've been working on implementing bgfx with noesisgui. I think I'm pretty close and (hopefully) just facing the last few problems.
When I use
_view->SetSize(width, height)
how does the render context get that information? None of the render target functions seem to get called, createTexture width and height are unrelated to the _view->SetSize so I'm a bit lost.

The more important issue I'm facing is that the button isn't rendering. I've tried converting this https://github.com/Noesis/Tutorials/tre ... rationGLUT to use bgfx (& glfw).
The clicking mouse artifacts are just from the GIF and aren't actually there.
The intended outcome is this:
But my project produces this outcome:

Maybe a helpful note. When I was playing around with SetSize I had to manually change the view size (e.g. from
BeginOnscreenRender()
{
	bgfx::setViewRect(this->viewId, 0, 0, this->width, this->height)
}
to
bgfx::setViewRect(this->viewId, 0, 0, this->width, this->height / 4)
I got this outcome:
This version has most of the text and it looks like the button is there just extremely stretched (not sure if you can see it)

Here is my github project where I'm just trying to get it to work: https://github.com/TasmanianNoob/Noesis ... ree/master
 
User avatar
jsantos
Site Admin
Posts: 4123
Joined: 20 Jan 2012, 17:18
Contact:

Re: BGFX Noesis Implementation not working

09 Nov 2023, 13:28

how does the render context get that information? None of the render target functions seem to get called, createTexture width and height are unrelated to the _view->SetSize so I'm a bit lost.
It works the other way around. You must create and bind a render target with specific dimensions, and inform about those dimensions to the view by calling SetSize.

My advice is that you use RenderDoc to compare our GLUT example with your implementation to understand where the differences are.
 
TasmanianNoob
Topic Author
Posts: 5
Joined: 15 Nov 2022, 03:38

Re: BGFX Noesis Implementation not working

10 Nov 2023, 07:05

how does the render context get that information? None of the render target functions seem to get called, createTexture width and height are unrelated to the _view->SetSize so I'm a bit lost.
It works the other way around. You must create and bind a render target with specific dimensions, and inform about those dimensions to the view by calling SetSize.

My advice is that you use RenderDoc to compare our GLUT example with your implementation to understand where the differences are.
I've been looking through RenderDoc but I've gotten stuck. It looks like the state is roughly the same but the opengl version renders the elements in a different order to bgfx. BGFX draws the button first before it is overwritten by the other details. The last step is drawing the text but it doesn't appear; not sure why. OpenGL draws the button after the background so it isn't overwritten.

I'm unsure about changing the render order. Do you know what should be affecting that or how I can change the order?

I've included images and the actual renderdoc captures.
OpenGL draw order:
BGFX draw order:
OpenGL state changes:
BGFX state changes (only missing the actual draw command because the list is long):
OpenGL capture: https://1drv.ms/u/s!ArbdWsCd5o0O1wiYrUb ... u?e=wZpe92
BGFX capture: https://1drv.ms/u/s!ArbdWsCd5o0O1wkO1N6 ... i?e=pk7YTQ
 
TasmanianNoob
Topic Author
Posts: 5
Joined: 15 Nov 2022, 03:38

Re: BGFX Noesis Implementation not working

10 Nov 2023, 10:15

how does the render context get that information? None of the render target functions seem to get called, createTexture width and height are unrelated to the _view->SetSize so I'm a bit lost.
It works the other way around. You must create and bind a render target with specific dimensions, and inform about those dimensions to the view by calling SetSize.

My advice is that you use RenderDoc to compare our GLUT example with your implementation to understand where the differences are.
I've been looking through RenderDoc but I've gotten stuck. It looks like the state is roughly the same but the opengl version renders the elements in a different order to bgfx. BGFX draws the button first before it is overwritten by the other details. The last step is drawing the text but it doesn't appear; not sure why. OpenGL draws the button after the background so it isn't overwritten.

I'm unsure about changing the render order. Do you know what should be affecting that or how I can change the order?

I've included images and the actual renderdoc captures.
OpenGL draw order:
BGFX draw order:
OpenGL state changes:
BGFX state changes (only missing the actual draw command because the list is long):
OpenGL capture: https://1drv.ms/u/s!ArbdWsCd5o0O1wiYrUb ... u?e=wZpe92
BGFX capture: https://1drv.ms/u/s!ArbdWsCd5o0O1wkO1N6 ... i?e=pk7YTQ
Oops looks like that was from bgfx::reset resetting the call to bgfx::setViewMode.
BeginOnscreenRender now includes
bgfx::setViewMode(viewId, bgfx::ViewMode::Sequential);
 
User avatar
jsantos
Site Admin
Posts: 4123
Joined: 20 Jan 2012, 17:18
Contact:

Re: BGFX Noesis Implementation not working

10 Nov 2023, 11:07

Great, so problem solved?
 
TasmanianNoob
Topic Author
Posts: 5
Joined: 15 Nov 2022, 03:38

Re: BGFX Noesis Implementation not working

10 Nov 2023, 11:34

Great, so problem solved?
Just fixed everything up. If someone comes across this thread in the future I would probably recommend learning from https://github.com/kuncarous/nextmu/tree/main instead, though my implementation should probably work. I just found kuncarous' yesterday, so my code is based on the older bgfx implementations and is probably lacking in functionality.

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 0 guests