[2.1] Creating 2D objects

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Jay721
Halfling
Posts: 62
Joined: Mon Jan 29, 2018 8:19 am

[2.1] Creating 2D objects

Post by Jay721 »

Hello, I’m looking for a way to create 2D rectangles on top of the screen that can be resized, repositioned and recoloured at any time. I know that there is Overlays in v1 Ogre, is this what I should use?

Also, I need to be able to add images on top of the screen too.

Thanks for reading
User avatar
Ybalrid
Halfling
Posts: 89
Joined: Thu Jul 10, 2014 6:52 pm
Location: France
x 31
Contact:

Re: [2.1] Creating 2D objects

Post by Ybalrid »

The 2.1 samples are using overlays to draw text, and also, for example in the one called "ShadowMapDebugging" to show textures on top of the screen. I never looked into it, but it is definitively possible to use the overlay component in Ogre 2.1
Ogre_glTF Ogre v2-1 GLTF2 loader : topic link github repo
BtOgre21 Fork of btOgre, for Ogre v2-1 : topic link github repo
OIS Current maintainer : Official repository
Annwvyn VR focused game engine using Ogre : https://github.com/Ybalrid/Annwvyn https://annwvyn.org/
hyyou
Gremlin
Posts: 173
Joined: Wed Feb 03, 2016 2:24 am
x 17
Contact:

Re: [2.1] Creating 2D objects

Post by hyyou »

Here is a one of possible ways to do it:-

I create a dedicated render queue for it (e.g. 8th render queue) in compositor.

Code: Select all

pass render_scene
			{
				//meaning: draw 2D as popup
				execution_mask			0x02
				viewport_modifier_mask	0x02
				rq_first	8
				rq_last	9
			}
I need to mark the 2D Ogre::Item(s) to be visible only in the ortho camera (using execution_mask and viewport_modifier_mask).
For more information, see stereo-camera demo in the official repository.

Then I create a new ortho camera + viewport, and assign a 2D mesh (4 vertex plane) to Ogre::Item.
Post Reply