My guess is that your problem is that you are trying to create a non- power-of-two sized texture, which is not supported on the G1. Try using 512 x 512 as your texture dimensions. You can continue to use 480 x 320 for glDrawTexOES.
Here's how you can debug problems like this by yourself in the future: First, convert the error code to its symbolic value: 1281 is GL_INVALID_VALUE Then, read the OpenGL ES docs for the function that failed. Look at the "ERRORS" section. Check each of the possible reasons for the error code that you received. In this case you'll see that for glTexImage2D, you will see that GL_INVALID_VALUE is generated for these reasons: If width or height is less than 0 or greater than 2 + GL_MAX_TEXTURE_SIZE. If level is less than 0. If level is greater than log 2 max , where max is the returned value of GL_MAX_TEXTURE_SIZE. If internalFormat is not 1, 2, 3, 4, or one of the accepted resolution and format symbolic constants. If non-power-of-two textures are not supported and the width or height cannot be represented as 2 k + 2 border for some integer value of k. If border is not 0 or 1. On Dec 13, 1:14 am, Eong <[email protected]> wrote: > I used a ndk library to decode the frames and update the ShortBuffer > with RGB565 format. > I allocate the buffer in the activity like below. > > ShortBuffer m_byteCanvas = ShortBuffer.allocate(m_width * m_height); > ....... > And I use GLSurfaceView and set the renderer for it. > > mGLSurfaceView = new GLSurfaceView(this); > > mGLSurfaceView.setDebugFlags(GLSurfaceView.DEBUG_LOG_GL_CALLS); > mGLSurfaceView.setRenderer(new GRenderer()); > setContentView(mGLSurfaceView); > > In the GRenderer class, I just need to update the ShortBuffer to > screen. > ..... > gl.glBindTexture(GL10.GL_TEXTURE_2D, tex); > gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGB, m_width, m_height, > 0, GL10.GL_RGB, GL10.GL_UNSIGNED_SHORT_5_6_5, m_byteCanvas); > l_gl.glTexParameteriv(GL10.GL_TEXTURE_2D, > GL11Ext.GL_TEXTURE_CROP_RECT_OES, > new int[] {0, 0, 480, 320}, 0); > > public void onDrawFrame(GL10 gl) { > gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGB, m_width, m_height, > 0, GL10.GL_RGB, GL10.GL_UNSIGNED_SHORT_5_6_5, m_byteCanvas); > ((GL11Ext)gl).glDrawTexiOES(0, 0, 0, 480, 320); > > } > > This works fine on the emulator (1.5 and 1.6), but when I tested it on > my G2 and G1, it gave me glError 1281 on glTexImage2D. If anybody can > help with this? > > PS: > I tried Canvas and the performance is not good enough, it takes more > than 30ms to draw a frame.(480x320). -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

