Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 11-Sep-2019 20:08:26

ARappy
Member
Registered: 15-Aug-2019
Posts: 12

Screen resolution problem on Android export : everything becomes tiny

Hi,

My project is working fine now, but i have apparently a last annoying problem of screen resolution.

When using OS3D under win7 with a screen resolution of 1440x900, every elements of project is rendered fine (2D text & pictures, 3D mesh...).

But after exporting to android tablet Lenovo Tab 2 A8-50 (screen: 1280x800, Android 5.1), all 2D user UI objects appears very very tiny: text zone, dialoglist, custom interface...

For example a text written in custom interface plugit with font size 20, appears like something size 3 on the tablet. Also a Dialoglist plugit window, is so small, i can barely click on the ok button to close it.

I don't understand why all the scene is so shrink between windows version and android export. The resolution of the screen of the pc & tablet are very close (1440x900 vs 1280x800), but the size of the scene is rendered completely differently.

I have try different width & height default size in OS3D project settings (player settings), with no effect.

The problem comes certainly from those Lenovo tablets, but there isn't any settings i can find to change that (android settings to set text size doesn't fix the problem).

The only solution i found is to increase a lot the font size and width/height of all 2D user interface control (button, text...) in windows, where they are now very huge, even cut at bottom, but then in Android they appears quite normaly.

But i can't do this with dialogbox UI taken from interface plugit folder (dialog list, dialog number, dialog text input) for which there is unfortunately no settings to change the font size, so they stay very tiny and quite unusable. The problem is that i use a lot of them in my project.

I'm teacher, doing this project for my student and can only use this model of tablets that are available at my school.

Does someone knows if there is a setting somewhere when export to android to change something about screen resolution, or what could cause this problem ?

As this project is also using the webcam for AR recognition, and the webcam resolution on my pc & the tablets is quite different, could the problem comes from this ?

Thank you very much for any help.

Offline

#2 11-Sep-2019 20:14:04

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,081
Website

Re: Screen resolution problem on Android export : everything becomes tiny

Hello,
we made a change for this in the last OS3D version, to update the components depending of the mobile DPI screen.
What version of OS3D are you using ?

Offline

#3 12-Sep-2019 20:26:47

ARappy
Member
Registered: 15-Aug-2019
Posts: 12

Re: Screen resolution problem on Android export : everything becomes tiny

Hi arkeon,

Thank's for replying.

I'm using the last version available on OS3D website 1.81 – 31/07/2019 as i started to try it this august.
Is there a beta somewhere i can try to fix this problem ?

I have also try the apk on my personal mobile (display: qhd 2560x1440, dpi > 500) and there the texts and the windows dialog have normal size (or a little bit too big), but no problem to use them.

So i'm asking myself if it is not a display setting problem with the Lenovo tablets (but didn't find a settings to change that in android parameters).

Last edited by ARappy (12-Sep-2019 20:51:12)

Offline

#4 13-Sep-2019 08:36:16

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,081
Website

Re: Screen resolution problem on Android export : everything becomes tiny

It use the Android API to get the screen DPI, maybe the lenovo tablet send a bad value hmm

Offline

#5 15-Sep-2019 00:36:42

ARappy
Member
Registered: 15-Aug-2019
Posts: 12

Re: Screen resolution problem on Android export : everything becomes tiny

Hi arkeon,

I have investigate further and find where the problem comes from.

1) _getDeviceScreenDensity:

First i try to check if the tablet returns correctly the screen dpi value. If i'm not mistaking,
this test is done in OS3D by calling _getDeviceScreenDensity(), you can find for example in ScolExternal.java at Line 86 here:
 
     OS3D\androidDeployerTools\scolbase\java\org\imaginer\scol\

  public float getDeviceScreenDensity()
  {
    return mActivity.getApplicationContext().getResources().getDisplayMetrics().density;
  }

As you said it calls Android's API getDisplayMetrics().density that return (display dpi)/160 (resolution independant dpi value).

As this function can be called directly inside a link parameter code:

      let _getDeviceScreenDensity -> dpi in
      ftoa dpi

i could check that the value is correct for my personal mobile and Lenovo Tablets.

For example, resolution of tablet is 1280x800 and the dpi is given by Lenovo to be 213dpi.
The value returned by _getDeviceScreenDensity is 1.331250, that corresponds well to 213/160.

So there is no problem from this side.


2) fVUIPIXELDENSITY:

_getDeviceScreenDensity is called at startup by fun VUIinit(sessionstr) in v3dui.pkg
located in OS3D\partition_LockedApp\tools\os3dlib. This file defines all the 2D UI in OS3D as far as I have understood it.

So I check if _getDeviceScreenDensity value was correctly returned in this part of code, and the answer is yes.

Then check other parameters that appears in v3dui.pkg since Ln7141, especially the final fVUIPIXELDENSITY that is used for all 2D UI to set their size according to display dpi.

   let SO3ViewportGetPixelPositionSize viewportstr.V3D_viewport -> [_ _ vw vh] in
   let max vw vh -> scsize in
   let if scsize > 1920 then 2.0 else if scsize > 1280 then 1.5 else 1.0 -> androidscale in 
    set fVUIPIXELDENSITY = if (_platform == SCOL_PLATFORM_ANDROID) then 1.0 /. (_getDeviceScreenDensity /. androidscale) else if (_platform == SCOL_PLATFORM_IOS) then 4.0 else 1.0;

When I calulate manualy fVUIPIXELDENSITY for those tablets i should got:

androidscale = 1.0 (because width = 1280)
so fVUIPIXELDENSITY = 1.0 / (1.331250 / 1.0) = 0.75117

but when I check fVUIPIXELDENSITY on runtime I got about 1.50, so twice the expected value.

Furthermore, when I force fVUIPIXELDENSITY to the expected value at 0.75117, then UI dialogbox size become normal (not tiny).

Apparently the problem comes from var "androidscale" that is set to 2.0 for any of the devices i have tested, although it should be at 1.0 for the tablet because its biggest resolution is 1280.

Not completely sure for now on, but it seems this appends because scsize is returned empty because vw vh are also empty after calling:

     let SO3ViewportGetPixelPositionSize viewportstr.V3D_viewport
     
I then try to set manually androidscale to 1.0 simply with:     set androidscale = 1.0;

and then the size of 2D UI dialogbox became normal (not anymore tiny). As i had also changed previously all font size to huge value to compensate this problem of dpi, i rechange them to normal font size 20, and voila, everything display fine now with normal size.


Of course, I usualy never make change directly in the framework code because it will break at next update, but as i need to use this app this week with my pupils, I will use this trick for the moment, waiting to find a better solution.


Could you know a reason why for some android devices the viewport size returned by SO3ViewportGetPixelPositionSize  could not return a value ?


The only thing that is missing me now is (french) accentued characters on Android. Especially for a school educational project, because they allow better word recognition for pupils with some reading difficulties. I would be particulary thankful if someday you could find a solution for that problem as you told us in a previous thread.


Anyway, Thank you very much for all this nice framework.

Last edited by ARappy (15-Sep-2019 10:19:46)

Offline

#6 16-Sep-2019 08:40:19

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,081
Website

Re: Screen resolution problem on Android export : everything becomes tiny

Hello,

good debug smile
maybe SO3ViewportGetPixelPositionSize  is called a little too son, I'll check that thanks !

Offline

#7 16-Sep-2019 08:57:50

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,081
Website

Re: Screen resolution problem on Android export : everything becomes tiny

if you just remove the VUIinit c3dXsession; line 374 in os3dplayer.pkg
then place VUIinit sessionstr;
after initScene viewstr sessionstr;
in initOs3dPlayer
I think this is my mistake

Offline

#8 16-Sep-2019 19:44:55

ARappy
Member
Registered: 15-Aug-2019
Posts: 12

Re: Screen resolution problem on Android export : everything becomes tiny

Thank you for the tip.

I'm not sure this is a mistake, as you had certainly test this part of the code with different devices before to include it in 1.81 last release.

Maybe for not very powerful device (like those tablets), launch is longer (in my case the app takes about 1min to start) and some UI components are not yet initialized when calling to get their size as you said, so return nil. I have already encountered such kind of problem on Visual Studio framework for other projects.

Another solution could be to let user choose to set "androidscale" var by code automatically, as it is done for the moment, or to override its value with a new option in the project settings or in android export windows, if some problem appears. For example like this (at bottom):

display settings

Furthermore, it would allow a more fine UI size choice, because in the actual code "androidscale" can only take 3 values:

screen size > 1920 :  androidscale = 2.0
screen size > 1280 :  androidscale = 1.5
sreen size <= 1280 :  androidscale = 1.0

So if your app targets specific android devices (for a school or a company for example) the UI dialog could be a little bit smaller or bigger than wished, as i have on my mobile with about 500dpi.

Last edited by ARappy (16-Sep-2019 20:00:19)

Offline

#9 17-Sep-2019 15:23:47

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,081
Website

Re: Screen resolution problem on Android export : everything becomes tiny

Offline

#10 18-Sep-2019 20:22:53

ARappy
Member
Registered: 15-Aug-2019
Posts: 12

Re: Screen resolution problem on Android export : everything becomes tiny

Woow ! Thank you very much ! It will be of great help for android user. I will try it as soon as the next update is released.

Offline

Board footer

Powered by FluxBB