Page 1 of 6

OGRE Renderer

Posted: 19 Feb 2012, 21:01
by Wolfmanfx
Hi,

Like everyone i am always looking for a good UI in a 3d env thats why i put some effort into libRocket to make the rendering shaderbased and extended the library with new features - i also used it within a small game - but i am not happy with the batch count and the memory usage also the html/css support feels a little bit outdated (it needs a lot love).

But the NoesisGUI looks really promosing first its future proof (XAML), effecient and i can reuse wpf ui -
And the best thing would be to combine this technology with OGRE :)

I already checked a little bit the headers inside NsRender its work todo there so my question who wants to help with the port - of course i will start with it by end of the week so we could coordinate us a little bit.

Also we need documentation and the source of the DXRenderer - the only thing i fear a little bit are the shader interfaces - but should be doable .

best regards Murat

Re: OGRE Renderer

Posted: 19 Feb 2012, 21:21
by Mind Calamity
I'm also looking into porting NoesisGUI to OGRE (and I assume so is AsaafRaman), I may not be that experienced, but I do believe I could help in some way.

A nice todo list would be a good way to start.

It shouldn't be too hard to port if there are some similarities to other generic GUI engines like MyGUI or CEGUI.

The only problem stopping me from working on it right away is that it's compiled with VS8, whereas everything on my computer is compiled with VS10, so it would take quite a bit of work to recompile everything. (and I don't even have VS8-9 installed).

Re: OGRE Renderer

Posted: 20 Feb 2012, 16:45
by jsantos
hi everybody, we have two approaches here for the integration with Ogre:
  • Following the steps described in the integration tutorial. Pass to Noesis the current device (dx9,dx10,dx11,ogl context) and let it render the GUI content on the passed surface.
  • Implement a Ogre rendersystem (implement the interface IRenderSystem). This step is more complex but more robust.
I think the second option is the one I would choose although the first one is easier. May be we could try doing the first one (only dx9 by now) and continue with the second option. What do you think?

I assume that lot of issues are going to appear here so probably the best option is give developers interested in a collaboration access to our internal trac system and svn repository and start organizing the job.

Re: OGRE Renderer

Posted: 21 Feb 2012, 12:40
by Mind Calamity
OK First thing I did was clean the ShadowVolume demo so I could understand it better (to ~300 lines) and made it a GUI-only demo, now the problem with OGRE is I have no direct way to access the IDirect3DDevice9 for now, I'm trying to downcast the Ogre::RenderSystem pointer I get from mRoot->getRenderSystem into Ogre::D3D9RenderSystem and then get the IDirect3DDevice9, but so far no luck.

Re: OGRE Renderer

Posted: 21 Feb 2012, 13:35
by Wolfmanfx
I posted a the answer to your question into the OGRE forum.
Maybe we should exchange our contacts?
My skype id is wolfmanfx. So Mind Calamity you impl. no the first approach?
I want to go the hard way (second option) the question what we use to share our code - private bitbucket repo?

Re: OGRE Renderer

Posted: 21 Feb 2012, 14:06
by Mind Calamity
Whatever you feel will be best as I've never worked while exchanging code before.

I'll add you on Skype, and we'll talk there (it's way more efficient than forums for these kinds of things).

And, yes I was trying to implement the first approach, I will try your suggestion when I get home in a few hours.

I also want to use the second approach for making a wrapper, but this was meant to be a quick test to see if I could easily implement NoesisGUI with OGRE.

Regards, Ilija.

Re: OGRE Renderer

Posted: 21 Feb 2012, 20:12
by Mind Calamity
Now, I got the initialization working, the problem is - after I initialize the renderer, I need to update it every frame, which is causing a problem:
	NsGetKernel()->Tick();

	// Update UI
	gUIRenderer->Update(evt.timeSinceLastFrame);

	NsGetSystem<IDX9RenderSystem>()->SyncInternalState();

 	const Ptr<RenderCommands>& commands = gUIRenderer->WaitForUpdate(); 
 	gUIRenderer->Render(commands);
 	gUIRenderer->WaitForRender();
This seems to block OGRE from rendering anything,

Here's a screenshot:

Image

I'll probably setup a BitBucket repository later.

Re: OGRE Renderer

Posted: 22 Feb 2012, 15:56
by jsantos
May be because you removed the stateblock to save and restore the state?

Re: OGRE Renderer

Posted: 22 Feb 2012, 18:45
by Mind Calamity
Update:
	IDirect3DDevice9* pd3dDevice = mContext;

	HRESULT hr;

	#define V(x) { hr = (x); }

	// Clear the render target and the zbuffer
	V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 66, 75, 121 ), 1.0f, 0 ) );

	// Render the scene
	if( SUCCEEDED( pd3dDevice->BeginScene() ) )
	{
		// Miscellaneous rendering
		{
			// Tick kernel
			NsGetKernel()->Tick();

			// Update UI
			gUIRenderer->Update(evt.timeSinceLastFrame);

			// Draw surface
			V(gStateBlock->Capture());
			V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_STENCIL, 0, 1.0f, 1 ) );
			NsGetSystem<IDX9RenderSystem>()->SyncInternalState();

			const Ptr<RenderCommands>& commands = gUIRenderer->WaitForUpdate(); 
			gUIRenderer->Render(commands);
			gUIRenderer->WaitForRender();
			V(gStateBlock->Apply());
		}

		V( pd3dDevice->EndScene() );
	}
Now it renders everything except the OGRE scene.. Hmm I'm trying to figure it out.

Here's a screenshot:

Image

Re: OGRE Renderer

Posted: 22 Feb 2012, 20:19
by jsantos
did you restore the state of the device after rendering the Gui?