我在项目RajawaliVuforiaExample(https://github.com/MasDennis/RajawaliVuforia)中导入了一个obj文件,obj和mtl文件是用blender导出的。 我按照教程https://github.com/MasDennis/Rajawali/wiki/Tutorial-17-Importing-.Obj-Files了 但我的应用程序崩溃了。
LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.a_obj);
objParser.parse();
mObject = objParser.getParsedObject();
getCurrentScene().addChild(mObject);
我追踪了错误: 在RajawaliRenderer.java文件中 在public void onDrawFrame(GL10 glUnused)方法中 靠近这条线:
public void onDrawFrame(GL10 glUnused) {
performFrameTasks(); //Execute any pending frame tasks
synchronized (mNextSceneLock) {
//Check if we need to switch the scene, and if so, do it.
if (mNextScene != null) {
switchSceneDirect(mNextScene);
mNextScene = null;
}
}
final double deltaTime = (SystemClock.elapsedRealtime() - mLastRender) / 1000d;
mLastRender = SystemClock.elapsedRealtime();
onRender(deltaTime);
++mFrameCount;
if (mFrameCount % 50 == 0) {
long now = System.nanoTime();
double elapsedS = (now - mStartTime) / 1.0e9;
double msPerFrame = (1000 * elapsedS / mFrameCount);
mLastMeasuredFPS = 1000 / msPerFrame;
mFrameCount = 0;
mStartTime = now;
if(mFPSUpdateListener != null)
mFPSUpdateListener.onFPSUpdate(mLastMeasuredFPS); //Update the FPS listener
}
int error = glUnused.glGetError();
if(error > 0)
{
if(error != mLastReportedGLError)
{
mLastReportedGLError = error;
throw new RuntimeException("OpenGL Error: " + GLU.gluErrorString(error) + " " + error);
}
} else {
mLastReportedGLError = 0;
}
}
和logcat:
E/AndroidRuntime(3839): FATAL EXCEPTION: GLThread 9505
E/AndroidRuntime(3839): java.lang.RuntimeException: OpenGL Error: invalid operation 1282
E/AndroidRuntime(3839): at rajawali.renderer.RajawaliRenderer.onDrawFrame(RajawaliRenderer.java:387)
E/AndroidRuntime(3839): at rajawali.vuforia.RajawaliVuforiaRenderer.onDrawFrame(RajawaliVuforiaRenderer.java:123)
E/AndroidRuntime(3839): at com.example.rajawalivuforiaexample.RajawaliVuforiaExampleRenderer.onDrawFrame(RajawaliVuforiaExampleRenderer.java:180)
E/AndroidRuntime(3839): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
E/AndroidRuntime(3839): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
E/dalvikvm(3839): threadid=17: exiting,name=pool-5-thread-1
E/dalvikvm(3839): threadid=18: exiting,name=pool-1-thread-1
有人可以帮助我吗?