Hello, Activity.onCreate() runs on application's main thread which is not associated with a GL context, hence the error message.
The usual way is to have a rendering thread which you can either associate with a GL context yourself by using EGL calls, or you can have the Android framework help you with it if you use GLSurfaceView. The latter is simpler if you are no expert (and given the somewhat unpredictable behaviour of EGL on Android). Check this out for a good explanation how to get going with GLSurfaceView: http://android-developers.blogspot.cz/2009/04/introducing-glsurfaceview.html On Tue, Aug 28, 2012 at 4:11 AM, Li Sun <lisundr...@gmail.com> wrote: > Hi, > > I just met a issue of glGenTextures. I wrote the below codes on > Activity.onCreate() function > > int[] mTextureNames = new int[1]; > GLES20.glGenTextures(1,mTextureNames,0); > SurfaceTexture mSurfaceTexture = new > SurfaceTexture(mTextureNames[0]); > > but mTextureNames[0] is always 0 and got the log "call to OpenGL ES API with > no current context (logged once per thread)". I think i may need to do some > initialization work before calling the source code. Would someone help to > tell me what's the steps ? Thanks a lot! > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en