Thursday 15 July 2010

android - GL ES 2.0 Failing to create opengl objects -


Actually I have 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 open-flag functions do not work. GLES20.createShader (GLES20.GL_VERTEX_SHADER); GLES20.glCreateProgram ();

All will return to 0.

Similarly:

  int posHandle = GLES20.glGetAttribLocation (mShader.getProgramId), "vPosition");   

-1 and so on.

How do I create my activity: // activity protected by zero (bundled saved instenstate) {super.onCreate (savedInstanceState); MSurfaceView = New GLESSurfaceView (this); Last Activity Manager Activity Manager = (Activity Manager) getSystemService (context.ACTIVITY_SERVICE); Last Configuration Infinity Configuration = ActivityManager.Get DeviceConfigurationInfo (); Last Boolean support_gles2 = configInfo.reqGlEsVersion> = 0x20000; If (support_gles2) {mSurfaceView.setEGLContextClientVersion (2); MSurfaceView.setRenderer (new GLESRenderer ()); } Other {//Log.e ("", "GLES does not support 2.0"); } SetContentView (mSurfaceView); }

I have found this in AndroidManifest.xml

  & lt; Use-enabled Android: glEVersion = "0x00020000" Android: required = "true" /> & Lt; Use-sdk android: minSdkVersion = "8" Android: targetSdkVersion = "16" />   

I think this GLES 2.0 functions should allow the right thing to do? I can give more code if needed, but basically just give it a shadder setup, top buffer, and then provide a basic shape.

Editors: People of Cheers

Edit: Let me know that GLES20.glGetError) GL_NO_ERROR flag

I found out what I was doing wrong I was building my shader and geometry in the constructor for my renderer class. What I did was taken to the informative (and) it was all good.

No comments:

Post a Comment