BGE-Viewport scaling problem - Bad Difference in Standaloneplayer

Hello guys and girls,
I am again in testing-mode :slight_smile:
But i guess i miss some basics of the viewport-system. You better check out the blendfile JMH_Viewport_Scaling_NO_BGUI.blend (417 KB), else my explanation is horrible. The In-Code-Comments should help a little though.

When its working, Press P and RIGHTARROWKEY or LEFTARROWKEY to scale the Viewport - thats all.
and do the same in the Standalone Player.
What should happen: The Viewport 1 AND 2 should start and stay at full height and by pressing the keys one viewport should grow in width and the other should shrink.

My Attempt of a Scaling Viewport shows different behavior in (how do i call it?) the internal player and the standaloneplayer.
In the standaloneplayer my screen is not only scaling to the right, but to the top and bottom too.
I dont understand why it isnt starting with full height either. As expected with this code:

y = bge.render.getWindowHeight()        
own['vp_1_top'] = y
cam1.setViewport(own['vp_1_left'], own['vp_1_bottom'], own['vp_1_right'], own['vp_1_top'])

Main Questions:
A) Why is the Standalone ViewPort not at 100% height?
B) Why is the ViewPort behaving different in the different Players?

A second issue is, that in the Standaloneplayer the Scaling Viewport seems to move instead of scaling.
It should stop because of this code:

if own['vp_1_x_percentage'] < 50:

Everytime you press RIGHTARROWKEY the Viewportvalue own[‘vp_1_right’] is increased and own[‘vp_2_left’] decreased.
Everytime you press the button, the property if own[‘vp_1_x_percentage’] is increased too. When 100% of the viewport is filled with Viewport 1(starting at 50% for each Viewport) it should stop. The Property Value own[‘vp_1_x_percentage’] begins at 0 and grows to 50 (50%+50% = 100).
In the Internal Player it goes well in ‘Fullscreen’ (Ctrl + UPARROWKEY) and has a little issue at the right border when not in ‘Fullscreen’.
In the Standalone Player it scales/moves to far and you see a black frame.

C) Why isn’t the the Viewport in the Standaloneplayer stopping at 50% of the Property value and you see a black frame?

Thanks for your time,
if there are questions or advice, i am glad to read about everything :slight_smile:

After checking out different blendfiles i experimented so far i am confused. I guess i found a bug!?
I remodelled my other files, so i have 100% the same code and logic as in the first blendfile.

Some pictures:

  1. The way it was in the blendfile above - if you got a different result, please tell me. You see unnecessary black.

2.This was the result, when pressing the keys. You see, both ViewPorts are getting more ?height?

3.After Testing with the Old file, i got this - it is the way it should be. After the start, it is perfectly in fullscreen, and there is no difference in heights through the manipulation with keys.

Let me know, what you think.
Thank you and have a nice day!

It has to do with your Framing setting. Letterbox will keep the aspect ratio the camera has (that you define with the resolution) by adding “blank space” around the viewports. Scale will stretch the ports as necessary while keeping their individual perspectives, and Extend will add or remove more visible space in each viewport as it stretches (i.e. if the view or window gets thinner height-wise, then you’ll be able to see more width-wise).

The short answer is to use the Scale framing mode, I believe.

I think scale changes the aspect ratio of your original view


At first, thanks for your reply!
I never payed attention to this setting.
Well, after doing so i am not less confused :wink:
The problem is, in both blendfiles the Settings of
are exact the same. But the result is different. Time to show both files: JMH_Bla_Letterbox_issue_file2.blend (417 KB) and JMH_Bla_Letterbox_issue_file1.blend (428 KB)

If i want to change the letterbox, i need to change which value? I still do not understand where to look.
I checked different camera-presets but no visual difference occured.

Does anyone know, why the letterbox-border changed from picture 1 to 2? I only manipulated the width of the viewport, nothing else. Why is the heigth changing?

  1. If you know sources of knowledge (books, whatever) let me know, this is interesting, but confusing.

Ty again! Have a nice day

  1. The framing mode options are present in the Render tab (the icon looks like a camera) when you’re in Blender Game view. Just scroll down to the “Display” section, which is third from the bottom.

  1. I’m guessing the letterbox border changed because the individual viewports changed sizes. So, the letterbox changes to be at the top of either, and the bottom of either (so you have that extra space at the bottom-right). I suppose letterbox is just two strips, regardless of what happens with your viewports / window.

So, whatever the arrangement, the letterbox will only be a strip at the top and bottom, or left and right. The little “extra box” in the bottom-right of your picture is a bit odd, then. It might be a bug. Now that I think about it, though, it’s probably trying to keep the same ratio of width-to-height of each viewport with Letterbox active, so it might be fine).

  1. I don’t really have any sources of information - just my own time spent messing around with it.

Solarlune, you are great!

->1) I misunderstood. I thought it is possible to change the ratio of the ‘grey and colored’ viewport versus the ratio of the black letterbox. So, that the viewport is shown for example 10% bigger.
Anyway, your assumptions and knowledge helped me a lot for arranging my thoughts. Its really hard to get what is happening and why and to decide if it is a bug or an intended feature.

->3) After looking around it seems like your homepage is one of the best sources to learn about the bge after all. It would be nice to have a catalogue of all the features/behaviors which are possible, but that may be to much work for a professional bookwriter :wink:

I guess this topic is solved. i will change it soon and rename the title to ‘viewport letterbox issue’ if possible. But feel free to spice up the topic with thoughts or questions.

Have a nice day!