Android - OpenGL:称为未实现的OpenGL es API



我正在开发一个使用 OpenGL 的 Android 应用程序,我想在一个类(渲染器)中添加这些方法,以获得场景的两个视图,即自动立体设备使用的图像:

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。

谢谢。

您已在清单中请求 OpenGL ES2,但在代码中使用 GLES1 功能。您应该只使用一个 API。

编辑:请在清单中使用"0x00010001"表示android glEsVersion。同时删除import android.opengl.GLES20;

最新更新