I am working on implementing OpenGL ES 2.0 completely in C ++ for Android.
At present, our program works without JNI or any java class in the project; instead, only NativeActivity is used.
By focusing on the very part of rendering the application, we got a simple way:
renderWorld()
{ GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f };
glClear ( GL_COLOR_BUFFER_BIT );
glVertexAttribPointer ( 0, 3, GL_FLOAT, GL_FALSE, 0, vVertices );
glEnableVertexAttribArray ( 0 );
glDrawArrays (GL_TRIANGLES, 0, 3 );
}
In Android.mk was included:
LOCAL_LDLIBS := -landroid -llog -lEGL -lGLESv1_CM -lOpenSLES -lGLESv2
And in AndroidManifest.xml it is reported:
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
So, the program debugs and compiles without problems. When launched, the message starts:
error libEGL called unimplemented OpenGL ES API
The forum gives recommendations for java - Android: GLES20: it is called by the unrealized OpenGL ES API , including the setEGLContextClientVersion command code:
GLSurfaceView surfaceView = new GLSurfaceView(this);
surfaceView.setEGLContextClientVersion(2);
However, setEGLContextClientVersion is a wrapper method intended for java.
SetEGLContextClientVersion OpenGL ES CG OGLES.
:
const EGLint attribList[] = {EGL_CONTEXT_CLIENT_VERSION, 2,EGL_NONE};
mContext = eglCreateContext(mDisplay, lConfig, EGL_NO_CONTEXT,attribList);
.