简体   繁体   中英

ARToolkit - call to OpenGL ES API with no current context

Currently I'm working on ARSimpleNativeCars in ARToolKit4Android that release on 2012-03-09. Before running the ARSimpleNativeCarsActivity class, I add in another menu class. In that class I start a new intent in a button: Intent myIntent = new Intent(Assignment_Main.this, ARSimpleNativeCarsActivity.class); startActivity(myIntent);

The camera view is working fine but the model does not appear. When I check my logcat, there is an error, call to OpenGL ES API with no current context.

But if I run the ARSimpleNativeCarsActivity class directly then is working.

You might want to check the update to ARToolKit for Android released 2012-12-06, which includes a fix for an issue which might be affecting you. The release notes say:

A problem with texture loading when using Wavefront .obj models in the Android examples has been fixed. Now, a new function glmReadOBJ2 delays loading and submission of the textures until the model is ready to be drawn. Previously, texture loading was performed when the model was loaded, and typically no OpenGL context would be valid at that point.

In other words, initialising the native code portion in the application, including model loading, was failing because textures were being loaded without a valid OpenGL context. The code now implements lazy loading of textures. You might be seeing the same problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM