CocosScharp Version 1.7.1+ Box2d error?

KerriganKerrigan USMember

Hi, i'm new to cocossharp and have created a test game (based on cocos banana).

However while trying to spin up box2d - I get the following error.

[libEGL] eglMakeCurrent:671 error 3002 (EGL_BAD_ACCESS). targeting (Android 4.4.2)

i'm using the new way to spin up a view via the ViewCreated event...

CCGameView gameView = (CCGameView)FindViewById (Resource.Id.GameView);
gameView.ViewCreated += LoadGame;

I then in LoadGame method trying something as simple as

var gravity = new b2Vec2 (0.0f, -10.0f);

and I get the trace error below...

I did note though - seeing the difference between (cocos banana delegate method - i.e. old way) - and the new ViewCreated. that the old way (delegate method) - everything is running on the main thread. While ViewCreated - runs on a thread pool thread. Is this an issue?

I did a lot of searching (note: I'm not using xamarin forms - since i have an indie license) and I haven't found too much info on version 1.7.1 and box2d.

If I can't find a solution - i'll have to use the older way to do things :(

any help would be appreciated

thanks,
Kerrigan.

stack track below...

[Mono] Searching for 'eglGetCurrentContext'.
[Mono] Probing 'eglGetCurrentContext'.
[Mono] Found as 'eglGetCurrentContext'.
[Adreno200-EGL] : EGL_BAD_ATTRIBUTE
Thread started: #3
Thread started: #4
[Mono] DllImport attempting to load: '/system/lib/libc.so'.
[Mono] DllImport loaded library '/system/lib/libc.so'.
[Mono] DllImport searching in: '/system/lib/libc.so' ('/system/lib/libc.so').
[Mono] Searching for 'gettid'.
[Mono] Probing 'gettid'.
[Mono] Found as 'gettid'.
Thread started: #5
[Mono] DllImport attempting to load: 'libGLESv2.dll'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.dll': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2//storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.dll" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.dll.so': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libaot-libGLESv2.dll.so" not found'.
[Mono] DllImport error loading library 'libGLESv2.dll': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libGLESv2.dll" not found'.
[Mono] DllImport error loading library 'libGLESv2.dll.so': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libaot-libGLESv2.dll.so" not found'.
[Mono] DllImport error loading library 'libGLESv2.dll': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libGLESv2.dll" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2//storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2" not found'.
[Mono] DllImport loaded library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glGetIntegerv'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glGetString'.
[Mono] DllImport attempting to load: 'libEGL.dll'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL.dll': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2//storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL.dll" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL.dll.so': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libaot-libEGL.dll.so" not found'.
[Mono] DllImport error loading library 'libEGL.dll': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libEGL.dll" not found'.
[Mono] DllImport error loading library 'libEGL.dll.so': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libaot-libEGL.dll.so" not found'.
[Mono] DllImport error loading library 'libEGL.dll': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2/libEGL.dll" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL': 'dlopen failed: library "/data/app-lib/MakinBacon.Android-2//storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL" not found'.
[Mono] DllImport loaded library '/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL.so'.
[Mono] DllImport searching in: 'libEGL.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libEGL.so').
[Mono] Searching for 'eglGetProcAddress'.
[Mono] Probing 'eglGetProcAddress'.
[Mono] Found as 'eglGetProcAddress'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glDisable'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBlendColor'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBlendEquationSeparate'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBlendFuncSeparate'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glColorMask'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glEnable'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glDepthFunc'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glDepthMask'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glStencilFunc'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glStencilOp'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glStencilMask'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glCullFace'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glFrontFace'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBindFramebuffer'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glViewport'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glDepthRangef'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glGetError'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glGenTextures'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBindTexture'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glTexParameteri'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glTexImage2D'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glPixelStorei'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glGenBuffers'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBindBuffer'.
[Mono] DllImport searching in: 'libGLESv2.dll' ('/storage/emulated/0/Android/data/MakinBacon.Android/files/.override/libGLESv2.so').
[Mono] Searching for 'glBufferData'.
[Mono] The request to load the retargetable assembly mscorlib v2.0.5.0 was remapped to mscorlib v2.0.5.0
Resolved pending breakpoint at 'GameUtils.cs:27,1' to void MakinBacon.Common.GameUtils.InitPhysics (CocosSharp.CCNode gameLayer) [0x00001].
[Adreno200-EGL] : EGL_BAD_ACCESS
[libEGL] eglMakeCurrent:671 error 3002 (EGL_BAD_ACCESS)
[Adreno200-EGL] : EGL_BAD_ACCESS
[libEGL] eglMakeCurrent:671 error 3002 (EGL_BAD_ACCESS)
[Adreno200-EGL] : EGL_BAD_ACCESS
[libEGL] eglMakeCurrent:671 error 3002 (EGL_BAD_ACCESS)

Answers

  • ProcogProcog GBMember

    I have exactly the same problem and unfortunately it is not limited to using box2d. If you back out of an app and then return to it from your Recents screen on Android you get the same error and all your particle affects turn into black blocks. I was happy to live with that hoping it would get fixed. However, now I've added box2d to my game as soon as I try to create my b2World it hangs, it doesn't matter where I put the code in the CCLayer (e.g. constructor, AddedToView, OnEnter) it always hangs. On the plus side this problem does not affect Windows Phone or iOS.

    One thing that's odd is that although I created my solution through the Cocossharp templates provided by Xamarin I had to manually fix a missing reference to OpenTK in the Android project.

    I also tried updating cocossharp to 1.7.1 but this had no affect.

    Xamarin can you please look into this, we're using your templates, your nuget package and your documentation says you support it.

  • KerriganKerrigan USMember

    Hey David, ... thought I was going insane - that I'd be the only one experiencing this issue...

    What I did was revert to the older version of cocossharp (the one they had in the bananas game) - in fact I just used that template and modified the namespace to get it working in my project (gah!)

    crossing fingers that xamarin folk fix this...

  • ProcogProcog GBMember

    Hi Dawn, I have another strange problem, which is also driving me nuts. Box2d collision detection is working on the iPhone Simulator but not on an iPhone 5 iOS 9.3 device. On the device I can collide with anything and my b2ContactListener never gets called. On the simulator it works fine. It also works on Windows Phone. Have you experienced this too? Can you please share your packages.config with me so I can see what version of cocossharp etc you are using?

  • MidnightCowMidnightCow GBMember
    edited May 2016

    Just to confirm i have the same/similar issue with CocosSharp+Box2D.

    When instantiating b2ContactListener via CocosSharp 1.7.1 i get GL context errors. Everything else works fine when using Box2D and targeting Android ( testing via the VS emulator ).

    In case it's useful to anybody else using Visual Studio - in order to use b2ContactListener i had to roll back to the older CocoSharp.PCL.Shared.1.5.1 and transfer all of my 1.7.1 code to that. In Visual Studio this meant uninstalling the CocosSharp Templates extension ( v1.7 ), then installing the old v1.5 extensions from the Mobile Essentials url and setting that to not automatically update. Once the v1.5 templates are installed, you can then create a project from the templates, and Update Nuget Packages to switch up to the v1.6 PCL if needed. ContactListener will then work as expected.

Sign In or Register to comment.