2 Viewports, Top Viewport transparent?

Autumn

01-06-2012 10:42:22

Hi Community,

I am using Mogre in windows form for displaying objects.
I have a viewport for my object and a second viewport for my coordinate system.

Code for my second viewport:
viewport2 = mWindow.AddViewport(cam2, 1, 0f, 0.7f, 0.15f, 0.3f); // (Camera Name, Z-Order, Left, Top, Width, Height)
viewport2.BackgroundColour = new ColourValue(0.20f, 0.20f, 0.5f, 0.0f);


This looks like this:



Is there any neat solution for making the second viewport transparent? (Or rather the backgroundcolour of the viewport)

I hope you can help me

Thanks
Autumn

zarfius

05-06-2012 04:03:00

Interesting problem. It reminds me of the RTT tutorial. http://www.ogre3d.org/tikiwiki/Intermediate+Tutorial+7
If you haven't read it yet perhaps it will help.

If that doesn't work, perhaps you can approach the problem a different way. Rendering your "axis" model in the same viewport as the Ogrehead but set the RenderQueueGroup to RenderQueueGroupID.RENDER_QUEUE_OVERLAY so that it renders on top. Just a thought, sorry if it's not very helpful. I haven't solved this problem before.

Oh, also, you'll probably get a better response on the main using ogre in practice forum. The answer will be in C++ so if you have trouble translating the code to C# just head back here and we'll help.

smiley80

05-06-2012 18:18:03

viewport2.SetClearEveryFrame(false);

Autumn

06-06-2012 18:54:14

viewport2.SetClearEveryFrame(false);

Perfect!!!!!!! Thank you very much :-)

Interesting problem. It reminds me of the RTT tutorial. http://www.ogre3d.org/tikiwiki/Intermediate+Tutorial+7
If you haven't read it yet perhaps it will help.

If that doesn't work, perhaps you can approach the problem a different way. Rendering your "axis" model in the same viewport as the Ogrehead but set the RenderQueueGroup to RenderQueueGroupID.RENDER_QUEUE_OVERLAY so that it renders on top. Just a thought, sorry if it's not very helpful. I haven't solved this problem before.

Oh, also, you'll probably get a better response on the main using ogre in practice forum. The answer will be in C++ so if you have trouble translating the code to C# just head back here and we'll help.


I was actually trying to do it with RTT, but I had problems transfering C++ to C# :/

The advantage of my 2. viewport is that it makes the display of my coordinate system pretty simple. The coordinate system has to maintain it's position on the screen (and the directions of the coordinate system-model axes have to match the directions of the global axes) while I rotate the camera around my model (here: Ogrehead) in viewport 1. I didn't know how to solve this in one viewport..

Thanks for the 'Using OGRE in practice' link. I will keep it in mind!



'viewport2.SetClearEveryFrame(false);' is the neat solution i was looking for
Problem [SOLVED] :)