Offset the camera view to make room for a menu?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mthud
Posts: 7
Joined: Sun Oct 30, 2011 7:13 am

Offset the camera view to make room for a menu?

Post by mthud »

Hey guys

I've created a maya style camera that rotates around the target. I've got this all working fine except for one thing. I have a GUI menu on the far right side of the screen that takes up about 1/3rd of the screen. So rather than my camera being in the center of the whole screen, I'd like it to be in the center of the left 2/3rds of the screen.

|------x------| <--- currently

|----x--------| <--- what I'm trying to get

Imagine a vertically split screen view where the left 66% of the screen has the camera view and the right 34% is a GUI menu. Now I'm trying to get that same effect without using a split screen because I'd like the GUI menu to be semi transparent and overlaying the game. So a lopsided camera view. Does anyone have any ideas on how I can achieve this? I'm hoping one of the camera functions can be used, but I don't understand FOV or Aspect Ratio.

Thanks in advaced
darksmaster923
Posts: 51
Joined: Tue Jan 02, 2007 11:04 pm
Location: huntington beach

Re: Offset the camera view to make room for a menu?

Post by darksmaster923 »

I don't see what you're trying to do, a splitscreen type of camera but not splitscreen?

Why don't you just increase the fov and rotate/move the camera?
Programmers are merely tools to convert caffeine into code.
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Offset the camera view to make room for a menu?

Post by ACE247 »

So your trying to make the gui not part of the camera's render window? Am I correct? but instead render the gui to the right of it on a separate window?
mthud
Posts: 7
Joined: Sun Oct 30, 2011 7:13 am

Re: Offset the camera view to make room for a menu?

Post by mthud »

Sorry guys I can see this is difficult to understand.

I want the focal point (target) of the camera to be 1/3rd across the screen rather than in the middle of the screen. I can't offset the target because the maya camera animator uses the target to rotate around. And the rotation doesn't feel natural if it's not rotating around the center point of my object.

Ok, I've just done up an image to try and illustrate the idea.
Image

This is what I've got currently
Image

And this is if I offset the target (it rotates around that point on the end of my object)
Image

So the background is still being displayed behind the menu on the left but it is just excess sky.
What you've described Ace would be my second choice if I cannot achieve the effect I am after.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Re: Offset the camera view to make room for a menu?

Post by Lonesome Ducky »

Code: Select all

driver->setViewport(...)
Looks exactly like what you need. Take a look at the API and see
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Offset the camera view to make room for a menu?

Post by ACE247 »

Well its all you need, splitscreen is done similar to this. And you cant have the gui and scene render in one viewport with the result you want. Just pass it a new screenspace rectangle you want for your render. Its 'Vely Vely' simple and the target of the new viewport will automatically be in the middle.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Offset the camera view to make room for a menu?

Post by mongoose7 »

It would appear that you need the camera to point to the right of the subject. If it is a FPS, just draw the reticule in the middle of the left section. Then everything will work alright until you shoot. I don't know how the FPS code determines a "hit", but it is at this point that it is necessary to know where the reticule is.
mthud
Posts: 7
Joined: Sun Oct 30, 2011 7:13 am

Re: Offset the camera view to make room for a menu?

Post by mthud »

Okay I had a look at driver->setViewport() and the split screen tutorial.

At first it looked good because I'd setViewport(leftside) then call smgr->drawAll(), then setViewport(rightside) and call GUIEnv->drawAll()

But then I realised that this would muckup my popup alerts and text drawn on the far top left... plus any other GUI items I decide to add in the main camera area...

Overall the setViewport() appears to be quite frustrating to use... is there a trick to using it? or anything else I could use instead?

@mongoose7
I'm not using FPS camera, I'm using a maya style camera - so I click and drag the mouse to rotate around the object on the screen. It uses the target as the pivot point and plays up when I offset it. See image three and imagine the object rotating around by it's edge... not ideal
Post Reply