【问题标题】:Android - OpenGL: called unimplemented OpenGL ES APIAndroid - OpenGL:调用未实现的 OpenGL ES API
【发布时间】:2014-01-02 15:48:11
【问题描述】:

我正在开发一个使用 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 输出中得到下一条消息,这些消息是由 cmets 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。

谢谢。

【问题讨论】:

    标签: android opengl-es


    【解决方案1】:

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

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

    【讨论】:

    • 感谢您的回答!但是你能帮我写代码吗?对于 GLES20 类型,函数 glMatrixMode、glLoadIdentity 和 gluLookAt 未定义,我不知道必须使用这些函数。
    • 我有同样的问题,但想使用 OpelGLes 2.0 。怎么可能?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-14
    • 2012-03-17
    • 1970-01-01
    • 1970-01-01
    • 2013-09-30
    相关资源
    最近更新 更多