Basically I've just delved into some Android and OpenGL ES 2.0 programming and hit a bit of a problem.
My code compiles fine and it runs but the opengl functions don't seem to be working.
GLES20.createShader(GLES20.GL_VERTEX_SHADER);
GLES20.glCreateProgram();
all will return 0.
Similarly this:
int posHandle = GLES20.glGetAttribLocation(mShader.getProgramId(), "vPosition");
will return -1 and so on.
How I create my activity:
// Activity
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mSurfaceView = new GLESSurfaceView(this);
final ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo();
final boolean supports_gles2 = configInfo.reqGlEsVersion >= 0x20000;
if (supports_gles2)
{
mSurfaceView.setEGLContextClientVersion(2);
mSurfaceView.setRenderer(new GLESRenderer());
}
else
{
//Log.e("", "Doesn't support GLES 2.0");
}
setContentView(mSurfaceView);
}
I've got this in AndroidManifest.xml
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
I think that should be it to allow GLES 2.0 functions to work right? I can give more code if needed but its basically just shader setup, creating vertex buffers and then rendering a basic shape.
Cheers guys
EDIT: I should add that GLES20.glGetError() returns GL_NO_ERROR flag