I assume you are uploading texture then drawing it just after. This
can be very slow as it stalls the GPU.
Try doing double or triple-buffering so that the texture you upload
with texImage2D is only drawn at next or next-next frame.

Regards,

On Sun, Oct 31, 2010 at 14:13, 袁堂夫 <[email protected]> wrote:
> Hi,how are you?
> We use Opengl 2.0 to develop a video programme on android with nexus one.
> We find that the fuction glTexImage2D is too slow,but we write a
> shader programme accord to  the sample GL2JNILib.
> I guess the GPU is not working, why it happened? how to fix it?
> help me,please.Thank you very much.
> ----------------------some important  code---------------------------
>       VideoView(Context context)
>       {
>                super(context);
>       //       m_Activity=(hello)context;
>                m_AndroidHolder = getHolder();
>                m_AndroidHolder.addCallback(this);
>                m_AndroidHolder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
>                m_AndroidHolder.setFormat(PixelFormat.RGB_565);
>    .
>    .
>    .}
> ------------------------------
>  public void initEGL()
>   {
>       mEGL = (EGL10)EGLContext.getEGL();
>       mGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
>       int[] curGLVersion = new int[2];
>       mEGL.eglInitialize(mGLDisplay, curGLVersion);
>       ConfigChooser configChooser=  new ConfigChooser(5, 6, 5, 0, 0, 0);
>       mGLConfig = configChooser.chooseConfig(mEGL,mGLDisplay);
>       mGLSurface = mEGL.eglCreateWindowSurface(mGLDisplay,
> mGLConfig,m_View.m_AndroidHolder, null);
>       int[] attrib_list = {0x3098, 2, EGL10.EGL_NONE };
>       mGLContext = mEGL.eglCreateContext(mGLDisplay, mGLConfig,
> EGL10.EGL_NO_CONTEXT, attrib_list);
>       mEGL.eglMakeCurrent(mGLDisplay, mGLSurface, mGLSurface, mGLContext);
>   }
> ------------------------------
>               glActiveTexture ( GL_TEXTURE0 );
>               glBindTexture ( GL_TEXTURE_2D, userData.textureId[0] );
>               glUniform1i ( userData.samplerLocY, 0);
>               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
>               glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
>               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
> GL_CLAMP_TO_EDGE);
>               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
> GL_CLAMP_TO_EDGE);
>               glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0,
> GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[0]);
>
> --
> 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
>

-- 
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

Reply via email to