Page 2 of 4

Re: Porting Gorilla

Posted: Wed Feb 04, 2015 11:26 pm
by Thyrion
what rendersystem do you use? just to be sure. font 40 exists in your gorilla file?

Re: Porting Gorilla

Posted: Wed Feb 04, 2015 11:36 pm
by xrgo
OgreGLRenderSystem
yes font 40 does exists =)
thank!

Re: Porting Gorilla

Posted: Thu Feb 05, 2015 6:13 pm
by Thyrion
i am using directx 11 currently and it works.
i think november's version should work, because he showed a working example vid :) but i didn't tried his version.
if i would have this problem, i would set a breakpoint in void Screen::renderQueueEnded( ... and would look if the caption is realy in the rendered layers.
i don't think there is a problem with opengl renderer, else november had said something?

tried to render a rectangle with background?

Re: Porting Gorilla

Posted: Thu Feb 05, 2015 6:58 pm
by N0vember
Well Ogre 2.0 won't render anything if you didn't create a Workspace.
Did you set one up ? If not how was the viewport created ? That's the code I would look at.
Also you don't even have to bother with viewports if you're going to render to the whole screen, just pass the window RenderTarget to gorilla.
(Actually I'm thinking this may be the reason, if you did setup a Workspace, try replacing the viewport with the renderwindow itself to see if that makes a difference)

Example :

Code: Select all

	Ogre::CompositorManager2* compositorManager = ogreRoot->getCompositorManager2();
		compositorManager->createBasicWorkspaceDef("Basic Workspace", Ogre::ColourValue::Black);

		compositorManager->addWorkspace(sceneManager, renderWindow, camera, "Basic Workspace", true);

		silverback->createScreen(sceneManager, renderWindow, "uiatlas"); // Pass the Ogre::RenderWindow here 

Re: Porting Gorilla

Posted: Thu Feb 05, 2015 7:53 pm
by xrgo
Thank you very much for your response!
It actually works now! (maybe has been working all the time) but... only when using "createBasicWorkspaceDef", the problem is that I am using a workspace defined in a script file, and I am adding it like this:
compositorManager->addWorkspace( sceneManager, renderWindow, mainCamera, "Workspace", true );
and I can see all my objects ok

this is my workspace:

Code: Select all

compositor_node mainRenderNode
{
	texture mrt target_width target_height PF_R8G8B8 PF_R8G8B8

	target mrt
	{
		pass clear
		{
			colour_value 0 0 0 1
		}
		pass render_scene
		{
			//shadows ShadowNode
			rq_first 0
			rq_last max
		}
	}

	out 0 mrt	
}

compositor_node FinalCompositionNode
{
	in 0 finalRender
	in 1 toRenderWindow

	target toRenderWindow
	{
		pass clear
		{
		}
		pass render_quad
		{
			material ByPassMat //just copy eveything
			input 0 finalRender
		}
	}
}

workspace Workspace
{
	connect mainRenderNode 0 FinalCompositionNode 0
	connect_output FinalCompositionNode 1 
}
I am doing some post process effects in between, they work, I just removed them for now to test

Thanks for everything!

Re: Porting Gorilla

Posted: Fri Feb 06, 2015 8:01 pm
by xrgo
Hi! I managed to make it work by changing this:

Code: Select all

    void Screen::renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation)
    {
        if(queueGroupId == Ogre::RENDER_QUEUE_OVERLAY &&  mRenderSystem->_getViewport() == mViewport->getViewport(1) && mRenderSystem->_getViewport()->getOverlaysEnabled()){
            if(mIsVisible && mLayers.size()){
                renderOnce();
            }
        }
    }
to this:

Code: Select all

    void Screen::renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation)
    {
        if(queueGroupId == Ogre::RENDER_QUEUE_OVERLAY && mRenderSystem->_getViewport()->getOverlaysEnabled()){
            if(mIsVisible && mLayers.size()){
                renderOnce();
            }
        }
    }
the bad thing is that I am getting post process effects on top of gorilla, maybe I have to create a different compositor pass or something. but its good enough for now since I am just using it for simple stuffs

thank you very much for the help!

Re: Porting Gorilla

Posted: Sat Feb 07, 2015 3:53 pm
by xrgo
WTF, I just updated ogre (hg pull && hg update v2-0-0RC1) build it again... and now my Gorilla stuffs looks like this xD

Image

I made a sky, the sun and the moon are a texture in a plane, and when either of those appears on the screen those gorilla "letters" actually disappear

Re: Porting Gorilla

Posted: Sun Feb 08, 2015 3:59 pm
by xrgo
its fixed now, I just re-estructured my project files/folders and now works again, I dont know why that happpend :S

Re: Porting Gorilla

Posted: Sun Feb 08, 2015 4:35 pm
by c6burns
xrgo wrote:its fixed now, I just re-estructured my project files/folders and now works again, I dont know why that happpend :S
Obv it was a signal from aliens ... Jodie Foster and Matt McConaughey have been dispatched to your house to debate the scientific and religious implications respectively. John Hurt is standing by from orbit!

Re: Porting Gorilla

Posted: Sun Feb 08, 2015 4:38 pm
by Klaim
Maybe you tried to parse HTML using regex?

Re: Porting Gorilla

Posted: Sun Feb 08, 2015 5:38 pm
by xrgo
c6burns wrote:
xrgo wrote:its fixed now, I just re-estructured my project files/folders and now works again, I dont know why that happpend :S
Obv it was a signal from aliens ... Jodie Foster and Matt McConaughey have been dispatched to your house to debate the scientific and religious implications respectively. John Hurt is standing by from orbit!
Image

Re: Porting Gorilla

Posted: Fri Feb 20, 2015 8:23 pm
by xrgo
Anyone got this working with Ogre 2.1?
I have the materials with shaders
I noticed that Screen::renderQueueEnded is not getting called

Re: Porting Gorilla

Posted: Sat Feb 21, 2015 3:20 pm
by AlexeyKnyshev
Please, create pull requests into git repository as soon as you have a progress in your development. Community is interested in Ogre 2.x port of Gorilla.

Regards, Alexey Knyshev

Re: Porting Gorilla

Posted: Thu Feb 26, 2015 3:25 pm
by Thyrion
Shouldn't that make the 2d material transparent?
old from working 2.0:
pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
new in 2.1:

Code: Select all

  d2Material = Ogre::MaterialManager::getSingletonPtr()->create("Gorilla2D", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
  Ogre::Pass* pass = d2Material->getTechnique(0)->getPass(0);
  Ogre::HlmsBlendblock transparent;
  Ogre::Pass::_getBlendFlags(Ogre::SceneBlendType::SBT_TRANSPARENT_ALPHA,
	  transparent.mSourceBlendFactor,
	  transparent.mDestBlendFactor);
  pass->setBlendblock(transparent);
  Ogre::TextureUnitState* texUnit = pass->createTextureUnitState();
  texUnit->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
  texUnit->setTextureFiltering(Ogre::FO_NONE, Ogre::FO_NONE, Ogre::FO_NONE);
The bitmapfonts still having the black background.

Re: Porting Gorilla

Posted: Thu Feb 26, 2015 3:48 pm
by xrgo
Thyrion wrote:The bitmapfonts still having the black background.
I guess youre lacking of:

Code: Select all

  Ogre::Pass::_getBlendFlags(Ogre::SBT_TRANSPARENT_ALPHA,
     transparent.mSourceBlendFactorAlpha,
     transparent.mDestBlendFactorAlpha);
mmm... but I tested this in another material and its not working either, it works with every other SceneBlendType but no SBT_TRANSPARENT_ALPHA... but I just started to investigate =)

Can you share your code?

Re: Porting Gorilla

Posted: Thu Feb 26, 2015 3:51 pm
by Thyrion
Can you share your code?
what code? i thought i did that in my last post :)

Re: Porting Gorilla

Posted: Thu Feb 26, 2015 4:03 pm
by xrgo
Thyrion wrote:
Can you share your code?
what code? i thought i did that in my last post :)
ahaha yes, but in 2.1 I cant see anything on my screen yet, I thought you made something different for 2.1
Screen::renderQueueEnded its not being called =(

Re: Porting Gorilla

Posted: Thu Feb 26, 2015 4:11 pm
by Thyrion
ahaha yes, but in 2.1 I cant see anything on my screen yet, I thought you made something different for 2.1
i just used the code from the mygui port from scrawl.
http://www.ogre3d.org/addonforums/viewt ... 17&t=30366
https://github.com/MyGUI/mygui/commit/8 ... f5574f934c
i picked out the compositorprovider.

Code: Select all

Ogre::IdString OgreCompositorPassProvider::mPassId = Ogre::IdString("MYGUI");

	MyGUIPass::MyGUIPass(const Ogre::CompositorPassDef *definition, const Ogre::CompositorChannel &target,
		Ogre::CompositorNode *parentNode, GraphicsManager& graphicsMgr)
		: Ogre::CompositorPass(definition, target, parentNode) ,m_GraphicsManager(graphicsMgr)
	{}

	void MyGUIPass::execute(const Ogre::Camera *lodCameraconst)
	{
	//here i call the gorilla renderonce method from the screen .. had to make it public
	//m_GraphicsManager.getGUIRenderer()._t_update();
	}

	m_compositorManager->setCompositorPassProvider(mPassProvider.get());

//--->>> added this pass to the CompositorTargetDef like in mygui
	// For the MyGUI pass
	targetDef->addPass(Ogre::PASS_CUSTOM, OgreCompositorPassProvider::mPassId);
and in the gorilla code the pass seems not to work correctly now:
in the function:

Code: Select all

 Ogre::MaterialPtr TextureAtlas::createOrGet2DMasterMaterial()

Re: Porting Gorilla

Posted: Mon Mar 09, 2015 5:13 pm
by xrgo
Thank you! did you solve the transparency issue?

I am having the same problem even with other materials, SBT_TRANSPARENT_ALPHA dont work, but SBT_ADD, SBT_MODULATE, etc they do.
I cant make transparent objects =(, I guess its the same issue you're having

This is my code, in this case pbs:

Code: Select all

    Ogre::HlmsManager *hlmsManager = Ogre::Root::getSingletonPtr()->getHlmsManager();
    Ogre::HlmsTextureManager *hlmsTextureManager = hlmsManager->getTextureManager();

    Ogre::HlmsBlendblock blendBlock;
    Ogre::HlmsMacroblock macroBlock;
    macroBlock.mDepthWrite = false;
    blendBlock.setBlendType(Ogre::SBT_TRANSPARENT_ALPHA,Ogre::SBT_TRANSPARENT_ALPHA);

    Ogre::String datablockName = "transparentMatTest";
    Ogre::HlmsPbsDatablock *datablock = static_cast<Ogre::HlmsPbsDatablock*>(
                hlmsPbs->createDatablock( datablockName,
                                          datablockName,
                                          macroBlock,
                                          blendBlock,
                                          Ogre::HlmsParamVec() ) );

    Ogre::HlmsTextureManager::TextureLocation texLocation = hlmsTextureManager->createOrRetrieveTexture( "textureWithAlpha.png", Ogre::HlmsTextureManager::TEXTURE_TYPE_DIFFUSE );
    datablock->setTexture( Ogre::PBSM_DIFFUSE, texLocation.xIdx, texLocation.texture );

    item->setDatablock(datablock);

Re: Porting Gorilla

Posted: Mon Mar 09, 2015 8:44 pm
by Thyrion
did you solve the transparency issue?
nope. i have no clue :( i think it's just not ready ?...

Re: Porting Gorilla

Posted: Tue Mar 10, 2015 2:14 am
by dark_sylinc
Thyrion wrote:
did you solve the transparency issue?
nope. i have no clue :( i think it's just not ready ?...
I don't know why is not working with you.
If transparent modes wouldn't be working, text rendering wouldn't work; and other UI code we have in an client engine wouldn't work either.

Re: Porting Gorilla

Posted: Tue Mar 10, 2015 12:18 pm
by Thyrion
Thx for the answer. At least i know now it should work.
Will try it again tonight. Maybe i find the solution in the Font.cpp file. :)

Re: Porting Gorilla

Posted: Tue Mar 10, 2015 2:44 pm
by dark_sylinc
Thyrion wrote:Thx for the answer. At least i know now it should work.
Will try it again tonight. Maybe i find the solution in the Font.cpp file. :)
You want to look for Font::loadImpl()

Also load Samples\Media\packs\OgreCore.zip and checkout HlmsTranslator::translate (remember the old gui widgets before SampleBrowser took over?) to see how they are getting parsed. They work as well.

Re: Porting Gorilla

Posted: Sun Mar 15, 2015 1:29 am
by N0vember
YEEEES

I got it to work :)

So it seems... When manually rendering with a RenderOp. (Which is the way Gorilla draws stuff for now)
- The scene blend parameter specified in the v1 material script does nothing at all.
- Setting the blendblock on the v1 material doesn't actually do anything at all.
- But setting the blendblock manually on the rendersystem before calling _render works.

Mattias, would that be a bug ? I'm a bit lost here but it feels a bit like something in the old materials got broken and no one noticed because Hlms is the way forward.
Or is it a side-effect of drawing manually with a material which is just not supposed to work anymore ?

It's different from how the Overlay are drawn with transparency, because they use Hlms, and here we are not using Hlms at all.

The drawing code was like this :

Code: Select all

mSceneMgr->_setPass(mPass);
mRenderSystem->_render(mRenderOp);
Now to render with the material transparency you have to do like this :

Code: Select all

mSceneMgr->_setPass(mPass);
mRenderSystem->_setHlmsBlendblock(mPass->getBlendblock());
mRenderSystem->_render(mRenderOp);
Shouldn't that have been handled by SceneManager::_setPass or RenderSystem::_render ?

Re: Porting Gorilla

Posted: Sun Mar 15, 2015 2:41 am
by Thyrion
lol nice (Your're the man! :) ). It works realy ... just one line of code is needed O.o
Already startet to convert the v1 namespaces XD.
  • VertexElement -> VertexElement2
  • RenderOperation-> VertexArrayObject
  • HardwareBufferManager-> VaoManager