Render preview image for Entity

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
randomcode
Halfling
Posts: 53
Joined: Wed Nov 11, 2015 11:31 am
Location: People's Republic of China
x 5
Contact:

Render preview image for Entity

Post by randomcode »

Hi, I am finding a way which can make OverlayElement show a picture of entity, I have tried Render To Texture, but failed

currently I use Overlay.Add3D function, but it need to adjust the axis manually,

So is any better idea to show an entity into a OverlayElement?
OpenMB(Open Source Mount&Blade Series)
https://github.com/cookgreen/OpenMB
frostbyte2
Gnoblar
Posts: 16
Joined: Mon Jun 03, 2019 2:45 pm
x 19

Re: Render preview image for Entity

Post by frostbyte2 »

don't know why you failed with rtt but that is the most common way of doing this
there is some code in the wiki which is not complete but should provide you with some base http://wiki.ogre3d.org/Render+entitys+to+rttTex
after creating the rtt texture you can simply display it with add2D

other possibilities
1) easy hack that may work is to use add3D and rotate the entity by rotating the RootBone of the entities skeleton
if your entity doesn't have a skeleton you can create a one bone skeleton and set all the entities vertex weights to that bone

3) other thing that i think might work is to use add3D but with a custom vertex shader for the entity and with a custom view matrix parameter

4) myGui framework has a custom mesh+animation presentation widget with fancy title and skins named renderBox
, they managed to get it right using rtt method and the entity is always fully visible at the center of the hud , you can also rotate by dragging the mouse
getting myGui to work may be a bit difficult, but once its running its very easy to manage this stuff
https://github.com/MyGUI/mygui/blob/mas ... Keeper.cpp is the demo that uses the renderBox class
https://github.com/MyGUI/mygui/blob/mas ... /RenderBox

edit: i've deleted 2 as it was irrelevant for you,
over all i would recommend on myGui if its not an overkill for you, cheers
Post Reply