GLBasic forum

Main forum => Bug Reports => Topic started by: spacefractal on 2012-Apr-07

Title: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: spacefractal on 2012-Apr-07
I removed the previos post because its did have too many edits and confuctions post, thus because I have invistated what its really happens. So sorry about it, but its still a bug, Sorry about it.

BUG:
- When surface is changed by Android due rotation or such when user slide keyboard or such thing, then glGasic does noet reflect that. A example can been seen in this video (when he slide controller in and out):
http://dl.dropbox.com/u/3236515/GreedyMouse/orintation_issue.wmv

If you using android:screenOrientation="sensor" in your manifest.xml, then its happens that too as well (which is much easier to invoke the bug).

What Happens?
- Glbasic does not do a SETSCREEN at all when surface have been changed, and then countinue to use the old resoulution like nothing have been happen. Neither GETSCREENSIZE or GETDESKTOPSIZE have been updated after that surface change, which is very important for Android and on ICS4.

With other word:
- Glbasic is not aware on a surface changes at all, which can been happens on Android. I also think its why its have its own problems on Kindle Fire due this?

To fix (which I cant do my self here):
- Glbasic should return the new resoulution to GETDESKTOPSIZE after a surfaceChanged() call, and then the surface size can then been set on SETSCREEN.
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: MrTAToad on 2012-Apr-07
Sounds like a useful thing to incorporate...
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: Kitty Hello on 2012-Apr-12
How about this:
Do not let the OS rotate the display (make your app work always in portrait). Then, use GETJOYX/GETJOYZ to determine the orientation and use SETORIENTATION to draw rotated?
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: spacefractal on 2012-Apr-13
I have allways did that, but I remind I did have a 90 degree rotation issue on a Android tablet (which use Landscape mode), which is not good at all (but I not sure why still), which is why I changed it to "nosensor". But "nosensor" have its own issue as you saw in the video.
 
So "The Xperia Play" did not respect the "nosensor" in the manifest.xml and rotated the display and changed its surface from Portrait to Landscape internally, which is why you see that issue. This is simply because glBasic is not aware when a surface change (and also in Sony Guidelines, you should also checks for surface changes).

So the best and the most correct way on Android is let the "sensor" auto rotate it and change the resoulution on the new surface, in that way its would fell a much a Android app and the 100% correct way.

So the best way is GlBasic should respect surface changes, which is invoked by the java call (which do happens), but the surface do never change, and hence either GETDESKTOPSIZE or GETSCREENSIZE is still on launched resoulution.

I also pretty sure its that its happens example on Kindle Play with odd mouse pointer simply due the surface have been changed and GlBasic have not respected it (so the screen was in potrait mode and hence mouse pointer might been wrong too).

So its a really important bug and I have no issue to eventuely pay for it (read donate), but Greedy Mouse is still about 1.5 month before a release, so in the end, nothing hurry (and I plans to ads some of other glbasic games too, but its nothing to debate here in this thread).
 
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: spacefractal on 2012-May-01
Later I looking what its happens in this bug in the fellow day. Its actuelly really important for ICS smartphones as well tables, due they often have a touchbar in the bottom or to right and here its should been device based rotation, not software.

What I think its nothing is happens when the c++ function onNativeResize() is called and its property a costume function, but I have not a clue where its is, so I could checks what it happens there. Its should resize to the new resoulution when it invoked, and update the GETSCREENSIZE values.

Howover by now I simply disable auto rotate on Android, since some devices have trouble with it and set it to "Landscape" mode only.... Later I simple do a manual rotation under option instead.
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: spacefractal on 2012-May-03
today I have tried doing different thing about this issue. I have tried varous settings in the manifest file, so its dosent rotate as well doing that in java runtime. But its still auto rotating, which might even do that on some devices with "nosensor". So I would nice to prefer "Sensor", also let Android rotate the surface and the game accour to that. But its not possible by now, but its also works nice when locked into one rotation, like "Landscape" (but progressbar would not rotated correctly then).

For future progress I have output the logfile, so you can see what its happens (from my HP TouchPad):

Code: (glbasic) [Select]
I/glbasic (12411): onCreate
I/glbasic (12411): /mnt/asec/com.headsoft.greedymouse-2/pkg.apk
I/glbasic (12411): done with updating
I/glbasic (12411): external files dir is /data/data/com.headsoft.greedymouse/files
I/glbasic (12411): external storage /mnt/sdcard/Download
I/glbasic (12411): Updating media files - Source Dir:
I/glbasic (12411): onResume()
I/glbasic (12411): assets found, copying...
I/glbasic (12411): assets still up to date, proceed to main...
I/SDL     (12411): surfaceChanged(): 4 768 976
I/SDL     (12411): ****************************************
I/SDL     (12411): orintation: 1
I/SDL     (12411): pixel format RGB_565
I/SDL     (12411): SDL_Android_Init()
I/glbasic (12411): timer
I/glbasic (12411): rbow
I/glbasic (12411): rbow init
I/glbasic (12411): SDL_init video
I/glbasic (12411): SDL_GetVideoInfo = 768x976 @ 16 bpp
I/glbasic (12411): Setting video mode: 768x976x16 fl=4800000
I/SDL     (12411): [STUB] GL_LoadLibrary
I/SDL     (12411): Starting up OpenGL ES 1.1
I/glbasic (12411): SDL_SetVideoMode seems to be 1
I/glbasic (12411): get accurate timer - 1st call
I/glbasic (12411): flip - 1st call
I/glbasic (12411): BGRA ext supported
I/glbasic (12411): Texture size limit: 4096
I/glbasic (12411): init fbo
I/glbasic (12411): 2D VP
I/glbasic (12411): OGRB init [OK]
I/glbasic (12411): Cptn
I/glbasic (12411): Network
I/glbasic (12411): Input
I/glbasic (12411): Window mode
I/glbasic (12411): Create DXin
I/glbasic (12411): sdl_grab
I/glbasic (12411): reptr
I/glbasic (12411): getexe
I/glbasic (12411): cd
I/glbasic (12411): set cdir to: /data/data/com.headsoft.greedymouse
I/glbasic (12411): exepath=curdir= /data/data/com.headsoft.greedymouse
I/glbasic (12411): set cdir to: files
I/glbasic (12411): Init Finalized
I/glbasic (12411): set cdir to: Media
I/glbasic (12411): set cdir to: languages
I/glbasic (12411): set cdir to: /data/data/com.headsoft.greedymouse/files/Media/
I/glbasic (12411): set cdir to: levels/light
I/glbasic (12411): set cdir to: /data/data/com.headsoft.greedymouse/files/Media/
I/SDL     (12411): surfaceChanged(): 4 1024 720
I/SDL     (12411): ****************************************
I/SDL     (12411): orintation: 2
I/SDL     (12411): pixel format RGB_565
I/glbasic (12411): onPause()
I/glbasic (12411): glbasicOnPause(1)
I/glbasic (12411): super.onPause
I/glbasic (12411): set cdir to: languages
I/glbasic (12411): set cdir to: /data/data/com.headsoft.greedymouse/files/Media/
I/glbasic (12411): Shut down GLB
I/glbasic (12411): glb is shut down
I/SDL     (12411): [STUB] GL_UnloadLibrary

As you can see, the first surfaceChanged() works quite nice and perform the correct init and all, but when surfaceChanged() invoked again, then its does nothing and I got a wrong display. I guess its somewhere in the Android Init() c++ code that dosent resize as its should, so its impossible to do that with activity java (unlike the assets one I did a workaround my self).
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: Kitty Hello on 2012-May-03
Ah. It's crashing on the HP touchpad when you rotate it?
Can you please post the manifest.xml changes for me to test it? I have a TP and if I can get it working here, it will be easy to fix.
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: spacefractal on 2012-May-03
no its did NOT crash, I just closed down few secs after rotation, so I could output the log file. With this xml file, Hp Touchpad would do the same thing as in video:

Code: (glbasic) [Select]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.headsoft.greedymouse"
      android:installLocation="preferExternal"
      android:versionCode="40"
      android:versionName="0.040">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="com.acer.android.XLONG_SCREEN" android:required="false" />
<supports-screens android:resizeable="false"
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:anyDensity="true" />
    <application android:label="Greedy Mouse" android:icon="@drawable/icon" android:debuggable="false">
        <activity android:name="org.libsdl.app.SDLActivity"
android:label="Greedy Mouse"
android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|orientation" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

also its does the same if android:screenOrientation="unspecified" changed to android:screenOrientation="sensor".

Its a pity since with "nosensor" as some devices still want to call that and rotate the screen, so not all devices respect that. Look on the video, which does the same when he draw the keyboard out. I think its complete the very same issue (but hard to do when I dont have the phone, but got invoked similar like that on HP Touchpad instead).
Title: Re: Android: Glbasic not updating surface when auto rotated.
Post by: Kitty Hello on 2012-May-11
Fixed in V11. I had to hint the new size to the core. Te showscreen will auto-correct the viewport, and the GETSCREENSIZE/GETDESKTOPSIZE will return the right values, taking care of the rotation.

Phew. That was a not so easy one.
Title: Re: Android: Glbasic not updating surface when auto rotated. {was fixed}
Post by: spacefractal on 2012-May-11
I should pay you for that one :-). i wait to you doing v11 donate button :-).

So awesome!
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: spacefractal on 2012-Sep-15
I have tested this in new GLBasic v11 beta and I just can say, this bug is not fixed correctly.

I use this code to detect a SURFACE CHANGE:

Code: (glbasic) [Select]
IF device$="a" OR device$="ak"
LOCAL xx, yy, x2, y2
GETSCREENSIZE xx, yy
GETDESKTOPSIZE x2, y2
IF x2<>xx OR y2<>yy
SETSCREEN x2, y2, 1
ScreenWidth=x2
ScreenHeight=y2
ENDIF
PORTRAIT=1
IF ScreenWidth>ScreenHeight  THEN PORTRAIT=0
DEPRINT("test resolution...."+xx+" "+yy+" "+x2+" "+y2)
ENDIF

my Manifest to test:
Code: (glbasic) [Select]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.spacefractal.greedymouse"
      android:installLocation="preferExternal"
      android:versionCode="990"
      android:versionName="0.990">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<supports-screens android:resizeable="false"
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:anyDensity="true" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="false">
        <activity android:name="org.libsdl.app.SDLActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|orientation" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

But if I start in Landscape mode and change to Portrait, then the game is still display in Landscape mode with a top left corner offset. Howover SETSCREEN is invoked after a hint, so I guess its more really a ORIENTATION issues that dosent reflect the SURFACE change as its should?

Howover I does not touch SETORIENTATION at all (which cause SETSCREEN to been crazy if I does), nor its should not been required.

PS. The assest issue with no animation is a easy fix, so dont worry about it, if you ask me.
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: spacefractal on 2012-Sep-15
a screenshots to see what it happens:
(https://dl.dropbox.com/u/3236515/GreedyMouse/Screenshot_2012-09-15-15-21-08.png)

its a ORINTATION issue that is not set correctly after the change, even I have not used SETORIENTATION at all. I thinks surface change is correct, but just not ORIENTATION for some reason.

The red circles is there ther controls was (but seen is normal, due wrong orientation after SETSCREEN and still thinks its in Landscape mode).
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: Kitty Hello on 2012-Sep-25
so, when you rotate - don't you get different GETSCREENSIZE informations now?
Or is the internal viewport broken after the rotation?
I really must dig out an Android device now...
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: spacefractal on 2012-Sep-26
GETSCREENSIZE works nicely and does as its should, but its does not rotate correctly and that is the main issue. I guess its a pure rotation issue, not a surface issue.

This was on a Android HP Touchpad, the same device you have.

Not looking since happens.
Title: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: Kitty Hello on 2012-Sep-27
Ah. So if the width>height, use setorientation 2, maybe?
Do you expect me to put that in the engine?
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: spacefractal on 2012-Sep-27
Im looking into this soon, but its might been tolate for Greedy Moues due its complexe code. By now its simply just pause when I roate my device and then its hanging (and AUTOPAUSE TRUE/FALSE diddent matter). Howover nothing problem to play the game only in landscape mode, its works fine.

Howover its better looking this issue with a little new project. Then I report soon what happens with the little new project. The first oddie is really its seen its start with 90 degree wrong in startup (the box example here start from top right rather than top left as its should). This could been the main issue, etc its have some orentation confuction. Howover I invistate later today.

Code: (glbasic) [Select]

LOCAL C=0
REPEAT
FOR i=0 TO 360 STEP 4
DRAWRECT 0, 0, i, i, RGB(100, 100, 100)
  SHOWSCREEN
  C=C+1
  IF C=200
  NETWEBEND "http://www.glbasic.com"
ENDIF
MOUSESTATE mx, my, mba, mbb
IF (mba=1 OR mbb=1) AND mx<20 AND my<20 THEN END
NEXT
UNTIL mba=1000
MOUSEWAIT
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: spacefractal on 2012-Sep-27
I have looked into more just now. Its a diffesivt issues in glbasic.

By now I use this manifest:

Code: (glbasic) [Select]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.unmapcom.rotosprite"
      android:installLocation="preferExternal"
      android:versionCode="1"
      android:versionName="0.001">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<supports-screens android:resizeable="false"
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:anyDensity="true" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="false">
        <activity android:name="org.libsdl.app.SDLActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

and doing this code:
Code: (glbasic) [Select]
AUTOPAUSE FALSE
ALLOWESCAPE FALSE

LOCAL C=0
SETCURRENTDIR("Media")
LOADSPRITE "block.png",0
REPEAT
FOR i=0 TO 360 STEP 4
GETSCREENSIZE x, y
DRAWRECT 0, 0, x, y, RGB(250, 250, 0)
DRAWSPRITE 0, x-100, y-100
DRAWSPRITE 0, 20, 20
DRAWSPRITE 0, x-100, 20
DRAWSPRITE 0, 20, y-100
DRAWRECT x/2-i/2, y/2-i/2, i, i, RGB(100, 100, 100)

DRAWRECT 10, y/2-i/8, i/4, i/4, RGB(100, 100, 100)
  SHOWSCREEN
  C=C+1
MOUSESTATE mx, my, mba, mbb
IF (mba=1 OR mbb=1) AND mx<20 AND my<20 THEN END
NEXT
UNTIL mba=1000
MOUSEWAIT


Also here was the log output:
Code: (glbasic) [Select]
I/SDL     ( 7018): ---------------------------------------------
I/SDL     ( 7018): ---               restart                 ---
I/SDL     ( 7018): ---------------------------------------------
I/SDL     ( 7018): onCreate
I/glbasic ( 7018): external files dir is /data/data/com.unmapcom.rotosprite/file
s
I/glbasic ( 7018): external storage /mnt/sdcard/Download
I/glbasic ( 7018): copy assets starts
I/glbasic ( 7018): assets found, copying...
I/glbasic ( 7018): updating assets...
I/glbasic ( 7018): Media is a directory
I/glbasic ( 7018): updating assets .. sleep
I/glbasic ( 7018): updating assets is done
I/glbasic ( 7018):    onCreate done
I/SDL     ( 7018): onResume()
I/SDL     ( 7018):     onResume done
I/SDL     ( 7018): ceateEGLSurface
I/SDL     ( 7018): surfaceChanged()
I/SDL     ( 7018): pixel format RGB_565
I/SDL     ( 7018): hint screensize to glb
I/SDL     ( 7018): SDL_Android_Init()
I/glbasic ( 7018): timer
I/glbasic ( 7018): rbow
I/glbasic ( 7018): rbow init
I/SDL     ( 7018): [STUB] GL_SetSwapInterval
I/glbasic ( 7018): SDL_init video
I/glbasic ( 7018): SDL_GetVideoInfo = 1024x720 @ 16 bpp
I/glbasic ( 7018): Requested SDL_OPENGL = 67108864
I/glbasic ( 7018): set up SDL for OpenGL-ES mode
I/glbasic ( 7018): Setting video mode: 1024x720x16 fl=4800000
I/SDL     ( 7018): [STUB] GL_LoadLibrary
I/SDL     ( 7018): ceateGLContext
I/SDL     ( 7018): initEGL 1.1
I/SDL     ( 7018): ceateEGLSurface
I/SDL     ( 7018): ceateEGLContext
I/glbasic ( 7018): SDL_SetVideoMode seems to be 1
I/glbasic ( 7018): get accurate timer - 1st call
I/glbasic ( 7018): flip - 1st call
I/glbasic ( 7018): BGRA ext supported
I/glbasic ( 7018): Texture size limit: 4096
I/glbasic ( 7018): init fbo
I/glbasic ( 7018): 2D VP
I/glbasic ( 7018): OGRB init [OK]
I/glbasic ( 7018): Cptn
I/glbasic ( 7018): Network
I/glbasic ( 7018): Input
I/glbasic ( 7018): Window mode
I/glbasic ( 7018): Create DXin
I/glbasic ( 7018): sdl_grab
I/glbasic ( 7018): reptr
I/glbasic ( 7018): getexe
I/glbasic ( 7018): cd
I/glbasic ( 7018): set cdir to: /data/data/com.unmapcom.rotosprite
I/glbasic ( 7018): exepath=curdir= /data/data/com.unmapcom.rotosprite
I/glbasic ( 7018): shoeboxing...
I/glbasic ( 7018): init gettimer
I/glbasic ( 7018): clear screen
I/glbasic ( 7018): flip
I/glbasic ( 7018): mk2D
I/SDL     ( 7018): query glb_asset_copy_done: true
I/glbasic ( 7018): finding font...
I/glbasic ( 7018): set cdir to: files
I/glbasic ( 7018): Init Finalized
I/glbasic ( 7018): set cdir to: Media
I/SDL     ( 7018): onPause()
I/SDL     ( 7018): glbasicOnPause(1)
I/SDL     ( 7018): super.onPause
I/SDL     ( 7018):    onPause done
I/glbasic ( 7018): Shut down GLB
I/glbasic ( 7018): glb is shut down
I/SDL     ( 7018): [STUB] GL_UnloadLibrary

The above was happens on my HP Touchpad with Android 4.

PS. I have before got hints before, even its not worked 100%. Howover I have no problems using a fixed orintation in my game.
Title: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: Kitty Hello on 2012-Sep-29
When you read "shut down glb". That's on purpose. Like END command.
Title: Re: Android: Glbasic not updating surface when auto rotated (issues in 11.171).
Post by: spacefractal on 2012-Sep-29
"Shut Down GLB" should not been happens on purpose after onPause() is invoked (when AUTOPAUSE set to FALSE), so its a bug. I did not called a "Shut Down GLB" there.....
Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: spacefractal on 2012-Oct-10
Looked into this today after fixed the Java issue. Its seen the shutdown issue was done when you using TargetAPI level 13 or higher, but if you set TargetAPI to 12 then glBasic does NOT quit but its got it hint as its should.

But its still some issues left. SETSCREEN is still not working correctly after the hint and X/Y is still been swapped on the other orientation.

Screen might start 90 degree wrong in startup, but that got fixed by SETORIENTATION 0 (which moved down for test), but after the hint then thing goes wrong (even I set SETORIENTATION 0).

Here the code (which also inclue some JAVACALL tests):

Code: (glbasic) [Select]

AUTOPAUSE FALSE
ALLOWESCAPE FALSE

STDOUT "IMPORT"
?IFDEF ANDROID
IMPORT "C" const char* android_JAVACALL(const char* string)
?ENDIF

LOCAL test$=android_JAVACALL("test")
STDOUT "test: "+test$

GETDESKTOPSIZE Xcreen, Yscreen
SETSCREEN Xcreen, Ycreen, 1

LOCAL C=0
Check_File("block.png")
SETCURRENTDIR("Media")
LOADSPRITE "block.png",0
REPEAT
FOR i=0 TO 360 STEP 4
GETSCREENSIZE x, y
DRAWRECT 0, 0, x, y, RGB(250, 250, 0)
DRAWSPRITE 0, x-100, y-100
DRAWSPRITE 0, 20, 20
DRAWSPRITE 0, x-100, 20
DRAWSPRITE 0, 20, y-100
DRAWRECT x/2-i/2, y/2-i/2, i, i, RGB(100, 100, 100)
DRAWRECT 10, y/2-i/8, i/4, i/4, RGB(100, 100, 100)
  SHOWSCREEN
  C=C+1
MOUSESTATE mx, my, mba, mbb
IF (mba=1 OR mbb=1) AND mx<20 AND my<20 THEN END
GETDESKTOPSIZE xDesk, yDesk
GETSCREENSIZE Xcreen, Yscreen
IF C=50 THEN SETORIENTATION 0

IF C=100
C=0
STDOUT xDesk+" "+yDesk+" :: "+Xcreen+" "+Yscreen
IF xDesk<>Xcreen AND yDesk<>Yscreen
SETSCREEN xDesk, yDesk, 1
ENDIF
ENDIF
NEXT
UNTIL mba=1000

FUNCTION CallJava$: Args$
LOCAL result$
?IFDEF ANDROID
result$=android_JAVACALL(Args$)
STDOUT "calljava: "+Args$+" "+result$
RETURN result$
?ENDIF
RETURN ""
ENDFUNCTION

FUNCTION Check_File: File$
LOCAL fileapksize=CallJava$("size:"+File$)
STDOUT "Check Filesize on "+File$+" :: "+fileapksize
LOCAL filelocalsize=GETFILESIZE(File$);

IF fileapksize<1 OR fileapksize<>filelocalsize
CallJava$("copy:"+File$)
ENDIF
ENDFUNCTION

here is the output I got:
Code: (glbasic) [Select]
I/SDL     (18573): ---------------------------------------------
I/SDL     (18573): ---               restart                 ---
I/SDL     (18573): ---------------------------------------------
I/SDL     (18573): onCreate
I/glbasic (18573): external files dir is /data/data/com.unmapcom.rotosprite/file
s
I/glbasic (18573): external storage /mnt/sdcard/Download
I/glbasic (18573): test 2
I/glbasic (18573): test
I/glbasic (18573):    onCreate done
I/SDL     (18573): glbasicOnPause(0)
I/SDL     (18573):     onResume done
I/SDL     (18573): ceateEGLSurface
I/SDL     (18573): surfaceChanged()
I/SDL     (18573): pixel format RGB_565
I/SDL     (18573): hint screensize to glb
I/SDL     (18573): SDL_Android_Init()
I/glbasic (18573): timer
I/glbasic (18573): rbow
I/glbasic (18573): rbow init
I/SDL     (18573): [STUB] GL_SetSwapInterval
I/glbasic (18573): SDL_init video
I/glbasic (18573): SDL_GetVideoInfo = 1024x720 @ 16 bpp
I/glbasic (18573): Requested SDL_OPENGL = 67108864
I/glbasic (18573): set up SDL for OpenGL-ES mode
I/glbasic (18573): Setting video mode: 1024x720x16 fl=4800000
I/SDL     (18573): [STUB] GL_LoadLibrary
I/SDL     (18573): ceateGLContext
I/SDL     (18573): initEGL 1.1
I/SDL     (18573): ceateEGLSurface
I/SDL     (18573): ceateEGLContext
I/glbasic (18573): SDL_SetVideoMode seems to be 1
I/glbasic (18573): get accurate timer - 1st call
I/glbasic (18573): flip - 1st call
I/glbasic (18573): BGRA ext supported
I/glbasic (18573): Texture size limit: 4096
I/glbasic (18573): init fbo
I/glbasic (18573): 2D VP
I/glbasic (18573): OGRB init [OK]
I/glbasic (18573): Cptn
I/glbasic (18573): Network
I/glbasic (18573): Input
I/glbasic (18573): Window mode
I/glbasic (18573): Create DXin
I/glbasic (18573): sdl_grab
I/glbasic (18573): reptr
I/glbasic (18573): getexe
I/glbasic (18573): cd
I/glbasic (18573): set cdir to: /data/data/com.unmapcom.rotosprite
I/glbasic (18573): exepath=curdir= /data/data/com.unmapcom.rotosprite
I/glbasic (18573): shoeboxing...
I/glbasic (18573): init gettimer
I/glbasic (18573): clear screen
I/glbasic (18573): flip
I/glbasic (18573): mk2D
I/glbasic (18573): finding font...
I/glbasic (18573): set cdir to: files
I/glbasic (18573): Init Finalized
I/glbasic (18573): IMPORT
I/glbasic (18573): calltest
I/glbasic (18573): test: This is Working String
I/glbasic (18573): Rbow::SetScreen( 1024,0)
I/glbasic (18573): calltest
I/glbasic (18573): Media/block.png is a file, reading...
I/glbasic (18573): calljava: size:block.png 8773
I/glbasic (18573): Check Filesize on block.png :: 8773
I/glbasic (18573): calltest
I/glbasic (18573): calljava: copy:block.png
I/glbasic (18573): set cdir to: Media
I/glbasic (18573): 1024 720 :: 1024 720
I/glbasic (18573): 1024 720 :: 1024 720
I/SDL     (18573): surfaceChanged()
I/SDL     (18573): pixel format RGB_565
I/SDL     (18573): hint screensize to glb
I/glbasic (18573): 768 976 :: 1024 720
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/SDL     (18573): surfaceChanged()
I/SDL     (18573): pixel format RGB_565
I/SDL     (18573): hint screensize to glb
I/glbasic (18573): 1024 720 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 1024,720)
I/glbasic (18573): 1024 720 :: 1024 720
I/glbasic (18573): 1024 720 :: 1024 720
I/glbasic (18573): 1024 720 :: 1024 720
I/glbasic (18573): 1024 720 :: 1024 720
I/glbasic (18573): 1024 720 :: 1024 720
I/SDL     (18573): surfaceChanged()
I/SDL     (18573): pixel format RGB_565
I/SDL     (18573): hint screensize to glb
I/glbasic (18573): 768 976 :: 1024 720
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/glbasic (18573): 768 976 :: 976 768
I/glbasic (18573): Rbow::SetScreen( 768,976)
I/SDL     (18573): glbasicOnPause(1)
I/SDL     (18573): super.onPause
I/SDL     (18573):    onPause done
I/SDL     (18573): surfaceDestroyed()

As you see X and Y is still swapped when I rotate 90 degree from start orientation. Rotating 180 degree works fine.

Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: Kitty Hello on 2012-Oct-16
It's fixed. I can't believe it.

When you set your manifest to
Code: (glbasic) [Select]
...
android:screenOrientation="sensor"
android:configChanges="orientation|keyboardHidden"

then the GETSCREENSIZE will return 1024x768 or 768x1024 depending on the device orientation. The menu bar will be rotated correctly. SETORIENTATION will stick to 0. If you want your app to always be landscape, you have to use setorientation manually.
Is that what's expected?




Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: johnparker29 on 2012-Oct-17
I looking what its happens in this bug in the other day. Its actuelly really essential for ICS mobile phones as well platforms, due they often have a touchbar in the end or to right and here its should been system centered spinning, not application.
Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: spacefractal on 2012-Oct-17
I have removed 2 post to avoid some confuction and instead I write this one (really sorry about that).

android:screenOrientation="sensor":
 - The hint system works and the system is orientation correct (as long TargetSDK is 12 or lower). The orientation is wrong, and resoulution by SETSCREEN is XY swapped. That happens on my HP Touchpad. I guess that xy swap bug is just fixed by Gernot.

android:screenOrientation="landscape": (with SETORIENTATION 0)
 - Set Orientation to 0 works on landscape devices (HP Touchpad), but fail on a loan HTC Sense.

android:screenOrientation="portrait": (with SETORIENTATION 0)
 - Works nice on HTC Sense, but fail on HP TouchPad.

To fix as I known:
- SETORIENTATION should set the value from Java's display.getOrientation(). That is really important! That fixed both Portrait issues on both devices.

- Howover Landscape mode still failed on HTC Sense, but shown like the picture (GETSCREENSIZE and GETDESKTOPSIZE values is swapped). Here its should set back to portrait mode and set ORIENTATION to value from GetOrientation(). I do believe that bug is property fixed.
Title: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: Kitty Hello on 2012-Oct-18
Use portrait or sensor, only. Both work with the next update. (On my touchpad)
Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: spacefractal on 2012-Oct-18
Yep, when SETSCREEN is fixed and dosent swap X/Y like this:
(https://dl.dropbox.com/u/3236515/GreedyMouse/htcerror.jpg)

Then all orientation issues can been fixed by this thread (include above device, which is a HTC Desire HD, Not a HTC Sense):
http://www.glbasic.com/forum/index.php?topic=8634.0 (http://www.glbasic.com/forum/index.php?topic=8634.0)

As you see, the orientation issue did fixed that by that java command too.

So I thinks its fixed now and Im looking forward to the next beta, and very thanks for the effoct (and I missing the donate button too, hehe).



Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: bigsofty on 2012-Oct-23
Maybe related...
Code: (glbasic) [Select]
glGetIntegerv(GL_VIEWPORT, viewPort);
Shows that the screen is for example 720x1280 on Android (Project setting is 1280x720) and on Windows it's 1280x720. On Android X & Y are also stuck in portrait mode, even though GLBasic is on Landscape. So raw OpenGLES is rendering YX for me, while GLB is rendering XY. I had assumed that this was due to some sort of GLB 2D transform but now I am not so sure it looks like a screen rotation issue.

BTW GETSCREENSIZE is reporting 1280x720 on Android, while GL_VIEWPORT is reporting 720x1280.

I may be reporting something that has already been seen to by the sounds of it though. If so, is the next beta available to test?
Title: Re: Android: Glbasic not updating surface when auto rotated (still in 11.171).
Post by: spacefractal on 2012-Oct-23
Yep its that its happens.

That bug should been fixed now. Glbasic can property still orientation wrong, but that is fixable by your self, so that bug is not 100% important at all.