我正在开发一个使用OpenGL的Android应用程序,我想在类(Renderer)中添加这些方法,以获取场景的两个视图,即自动立体设备使用的图像:
package com.s.cv;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.Arrays;
import static com.s.cv.Mesh.X;
import static com.s.cv.Mesh.Y;
import static com.s.cv.Mesh.Z;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import com.badlogic.gdx.backends.android.AndroidGL20;
import android.content.Context;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.GLU;
import android.opengl.Matrix;
import android.util.Log;
public class Renderer implements GLSurfaceView.Renderer {
...
private void setLeftEnv(GL10 gl) {
gl.glViewport(0, 0, (int) mWidth / 2, (int) mHeight);
gl.glMatrixMode(GL10.GL_MODELVIEW); //1
gl.glLoadIdentity(); //2
GLU.gluLookAt(gl, -mEyeDistance, 0.0f, 4.5f, mFocusPoint[0], mFocusPoint[1], mFocusPoint[2], 0.0f, 1.0f, 0.0f); //3
}
private void setRightEnv(GL10 gl) {
gl.glViewport((int) mWidth / 2, 0, (int) mWidth / 2, (int) mHeight);
gl.glMatrixMode(GL10.GL_MODELVIEW); // 1
gl.glLoadIdentity(); //2
GLU.gluLookAt(gl, mEyeDistance, 0.0f, 4.5f, mFocusPoint[0], mFocusPoint[1], mFocusPoint[2], 0.0f, 1.0f, 0.0f); //3
}
...
}
在清单文件中,我包含了以下代码行:
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"></uses-sdk>
但是当我运行应用程序时,我在logcat输出中获得了注释1,2和3所示行的下一条消息:
01-02 16:29:33.742: E/libEGL(6691): called unimplemented OpenGL ES API
该应用程序安装在名为LG Optimus 3D Max P720的设备中,该设备已获得Android版本2.3.6。
感谢。
答案 0 :(得分:2)
您已在清单中询问OpenGL ES2,但在代码中使用了GLES1功能。您应该只使用一个API。
编辑:请在清单中使用“0x00010001”for android glEsVersion。同时删除import android.opengl.GLES20;