Why do you need opengl for video output?

glTexImage2D is really slow  - but you can improve performance of
video app
if render more than one video frames into one data buffer,
so one call to glTexImage2D will pass to opengl subsystem more than
one videoframe
and then you can change video frames at opengl by switching texture
coordinate attribute (see glVertexAttribPointer)
Try another configs in config chooser it can be faster, try default
config.
Reduce video resolution.
Why for VIDEO you use GL_TEXTURE_WRAP_S,  try GL_CLAMP_TO_EDGE
Why GL_LUMINANCE - do you really need luminance texture or this way
you say to subsystem that you need 16bit texture?






On Oct 31, 9:13 am, 袁堂夫 <[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

Reply via email to