ZGESensor library stopped working

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

ZGESensor library stopped working

Post by Rado1 »

Ville, I tried to recompile all ZGESensor demo projects with the latest ZGE beta and all stopped working - sensor data are not updated. Could you please detect the problem? Thanks.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

It seems it stopped working when I made the change so that VBOs (and any OpenGL function) can be created in OnLoaded.

So now OnLoaded is called after the OpenGL context is created (just like on Windows) and for some reason this breaks the sensor library. Possibly because another thread is active when OpenGL runs. I tried switching back and then it works again (but vbos breaks).

I see you have optional logging in your library. Can you turn it on and verify that the functions get called correctly?
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

lolz, I was trying to figure out why I could not get this working either,. but guess this is why.

Please do post when you figure out how to get it running once again,. guess that tilting game is on hold. :(

On to the next thing,.
iterationGAMES.com
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:I see you have optional logging in your library. Can you turn it on and verify that the functions get called correctly?
I did and it seems that all function calls from ZGE are correct, see the attached log file. Some functions, such as sensorGetName, return correct values. The problem is that the callback function getSensorEvents is not called and therefore does not update sensor data.

Ville, what about to move OnLoaded call before the OpenGL context is created and to initialize VBOs in an AppState?
Attachments
log.zip
Sensor Demo 1 log
(2.48 KiB) Downloaded 432 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

The problem with changing back to the old behavior is that ZGE on Windows allow OpenGL calls in OnLoaded so it would reduce compatibility.

I see in your code that you use LOOPER_ID=1. But most code I find (like here) instead use the LOOPER_ID_USER constant which is defined to 3. Can you try that instead?
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, AFAIR looper id is not so important and can be any number for your application. Of course, different callbacks should have different ids. In fact, android_native_app_glue.h defines LOOPER_ID_MAIN=1, LOOPER_ID_INPUT=2, and LOOPER_ID_USER=3, but these are just helping constants, not mandatory. This is maybe the reason why some examples use 3 for user-defined loopers.

Anyway, I tried also 3 in ZGESensor but did not help.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

I just tested the latest ZGE beta update and it works with ZGESensor again. Hurrah!!!
Post Reply