Re: [android-developers] Surfaceflinger Overlay rendering

2010-12-28 Thread
Is the ACCESS_SURFACE_FLINGER  permisson error?

2010/12/28 Butchi Peddi :
> Hi,
>
> I am facing issues with surfaceflinger overlay. I created surfaceview
> and getting surface object from it in java.
>
> surface created from surfaceview is passed to native layer.
>
> In native layer created overlay from the surface and calling
> queuebuff() with valid data and dequeuebuf() on overlay.
>
> I am not able to see any video on display.
>
> Can anyone has idea what is going wrong?
>
> --
> 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


Re: [android-developers] How to use ndk to compile t emplate classes?

2010-12-24 Thread
搞错了,ndk可以自动编译.h里面的代码的
2010/12/24 赵杨阳 :
> You can try to implement in a .cpp file and when you need to use the class,
> #include "xxx.cpp"?
>
> 2010/12/24 袁堂夫 
>>
>> As you know that template classes are implemented in the   ".h"
>> header files, and the ndk is not build the ".h" files.
>>
>> When the ndk link the obj files, it will failed that the template
>> classes are not implemented.
>>
>> Who can help me fix this? Thank you very much, please~
>>
>> --
>> 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

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


[android-developers] How to use ndk to compile templ ate classes?

2010-12-23 Thread
As you know that template classes are implemented in the   ".h"
header files, and the ndk is not build the ".h" files.

When the ndk link the obj files, it will failed that the template
classes are not implemented.

Who can help me fix this? Thank you very much, please~

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


Re: [android-developers] call c++ function with jni and android ndk

2010-12-23 Thread
add some codes,like this:
--
static JNINativeMethod FileBrowseMethods[] = {
{"OpenStream", "(Ljava/lang/String;)V",
(void*)Java_yuan_tang_fu_FileBrowse_OpenStream },
};

static const char *FileBrowseClassName = "yuan/tang/fu/FileBrowse";

static int registerNativeMethods(JNIEnv* env, const char* className,
 
JNINativeMethod* gMethods, int numMethods)
{
jclass clazz;
//fprintf(stderr, "RegisterNatives start for '%s'", className);

__android_log_print(ANDROID_LOG_ERROR,"registerNativeMethods","RegisterNatives
start for '%s'", className);
clazz = env->FindClass(className);
if (clazz == NULL) {
//fprintf(stderr, "Native registration unable to find 
class '%s'",
className);

__android_log_print(ANDROID_LOG_ERROR,"registerNativeMethods",
"Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
if (env->RegisterNatives(clazz, gMethods, numMethods)<0) {
//fprintf(stderr, "RegisterNatives failed for '%s'", 
className);

__android_log_print(ANDROID_LOG_ERROR,"registerNativeMethods",
"RegisterNatives failed for '%s'", className);
return JNI_FALSE;
}
return JNI_TRUE;
}
static int registerNatives(JNIEnv* env)
{
if (!registerNativeMethods(env, FileBrowseClassName,
   
FileBrowseMethods, sizeof(FileBrowseMethods) /
sizeof(FileBrowseMethods[0]))) {
// return JNI_FALSE;
}


return JNI_TRUE;
}
typedef union {
JNIEnv* env;
void* venv;
} UnionJNIEnvToVoid;
jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
UnionJNIEnvToVoid uenv;
uenv.venv = NULL;
jint result = -1;
JNIEnv* env = NULL;
//printf("JNI_OnLoad");
__android_log_print(ANDROID_LOG_ERROR,"JNI_OnLoad", 
"JNI_OnLoad...");
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
//fprintf(stderr, "GetEnv failed");
__android_log_print(ANDROID_LOG_ERROR,"JNI_OnLoad", 
"GetEnv failed");
goto bail;
}
env = uenv.env;
if (registerNatives(env) != JNI_TRUE) {
//fprintf(stderr, "GetEnv failed");
__android_log_print(ANDROID_LOG_ERROR,"JNI_OnLoad",
"registerNatives failed");
goto bail;
}
result = JNI_VERSION_1_4;
bail:
return result;
}


2010/12/22 TobyKaos :
> Hello, I first run samples found in androind ndk and I create my own
> in C. I successfully print a hello world with c function.
>
> but now I want to call c++ function. Then I change file extensions
> to .cpp and remake with ndk-build. Ok that seems to work fine. I
> refresh my eclispe project. Ok eclispe seems to find my hello world
> function in new .so lib made in c++.
>
> Then I launched debug and application failed because it does not find c
> ++ function. My function is the same but I modify jni function in it
> to match c++ jni.
>
> My TestSTL.java
>
> package com.project.teststl;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.TextView;
>
> public class TestSTL extends Activity {
>    /** Called when the activity is first created. */
>   �...@override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        //setContentView(R.layout.main);
>
>        TextView  tv = new TextView(this);
>        tv.setText( stringFromJNI() );
>        setContentView(tv);
>    }
>
>    native public static String stringFromJNI();
>
>    static {
>                //System.loadLibrary("stlport_shared");
>            System.loadLibrary("teststl");
>        }
>
> }
>
> *
> my test.cpp file
>
> #include 
> #include 
>
> #include 
> #include 
>
> /* Call to initialize the graphics state */
> JNIEXPORT jstring JNICALL
> Java_com_project_teststl_TestSTL_stringFromJNI(  JNIEnv* env, jobject
> obj  )
> {
>        jstring s = (env)->NewStringUTF( "Hello from JNI !");
>
>        return s;
>
> }
>
>
>
> I repeat, in C all is ok (I just modify NewStringUTF for C or C++
> because are not the same definition).
>
> Please help me.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send 

[android-developers] how to use ndk to compile templ ate classes?

2010-12-23 Thread
As you know that template classes are implemented in the   ".h"
header files, and the ndk is not build the ".h" files.

When the ndk link the obj files, it will failed that the template
classes are not implemented.

Who can help me fix this? Thank you very much, please~

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


[android-developers] what is the meaning of FSL?

2010-12-20 Thread
Who can tell  me?  Thank you very much~

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


[android-developers] how use overlay to display yuv video frames ?

2010-12-19 Thread
I develop a video application on nexus one and  use isurface to create
overlay,but there is an error that Permission Denial: can't access
SurfaceFlinger.

Who can give me some idea to use overlay to display yuv frames?

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


[android-developers] How to display a raw YUV frame on android?

2010-12-14 Thread
First,I am sorroy that my English is so poor.  I try several method to
display the yuv frame, but failed always.These method belowed:

(1) I try to use opengl 2.0 and write shader, the question is that it
is too slowly when upload texture with glTexImage2D.
(2) I try to create Overlay from ISurface, but when the application
run, it showed that  ACCESS_SURFACE_FLINGER is failed.
(3) I try to open the frame device with
open("/dev/graphics/fb0",O_RDWR), but it failed that permisson denied.

Who can give me some useful suggestions? Thank you,please!

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


Re: [android-developers] open("/dev/graphics/fb0", O_RDWR) failded.

2010-12-14 Thread
Thank you,Gergely Juhász.
I just write an aplication and call jni to do this ,how to get root permission?

2010/12/14 Gergely Juhász :
> I think you need root permission for that.
>
> On 14 December 2010 09:54, 袁堂夫  wrote:
>>
>> I use jni to open the Framebuffer,but it failed,logcat showed that
>> permisson denied.
>> how to fix this question? thank you~
>>
>> --
>> 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

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


[android-developers] open("/dev/graphics/fb0", O_RDWR) failded.

2010-12-14 Thread
I use jni to open the Framebuffer,but it failed,logcat showed that
permisson denied.
how to fix this question? thank you~

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


[android-developers] can't access SurfaceFlinger

2010-12-09 Thread
I have used  in the
AndroidMenifest.xml.
But the error is still there. How to fix this error?
-
12-10 03:05:57.975: WARN/ServiceManager(1002): Permission failure:
android.permission.ACCESS_SURFACE_FLINGER from uid=10056 pid=2250

12-10 03:05:57.975: ERROR/SurfaceFlinger(1002): Permission Denial:
can't access SurfaceFlinger pid=2250, uid=10056

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


[android-developers] Can't access SurfaceFlinger

2010-12-09 Thread
Hi everyone,
I am using 
to access the SurfaceFlinger.
But I am getting the error
*W/ServiceManager(   59): Permission failure:
android.permission.ACCESS_SURFACE_FLINGER from uid=10036 pid=325
E/SurfaceFlinger(   59): Permission Denial: can't access SurfaceFlinger
pid=325,
 uid=10036*
How to Rectify the above error?
With Regards,
Mr Yuan..

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


[android-developers] who can give me android 2.2 system source code ?

2010-12-08 Thread
who can give me android 2.2 system source code ? Thanks,please~

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


Re: [android-developers] playing yuv file

2010-12-08 Thread
Can you show me your key codes for displaying? Then I maybe give u
some useful information.

2010/12/8 venu :
> Hi everyone,
>
> I am playing a yuv file on my hardware using my one own c
> application(using v4l2 interface).It is playing but display is not
> comming.If i play the samething on linux its gets display on lcd. In
> android just some blinking is there on lcd apart from that nothing is
> showing. How to play yuv file in android using own application or
> using android application.
>
>
> Any suggestion welcome..
>
> Thanks in advance
>
> --
> 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


Re: [android-developers] [北京招聘]安卓联航 公司招聘Android人才

2010-12-06 Thread
不至于吧,都跑这里招聘了,哈哈~多少钱一个月呢?

在 2010年12月7日 上午10:13,何斌斌  写道:
> 一、企业介绍:
> 安卓联航软件科技(北京)有限公司: http://www.andlisoft.com
> 二、职位描述:
> 从事Android相关软件的开发
> 三、职位要求:
> 1. Java技术扎实,同时有C++与Java开发经验优先;
> 2. 半年以上Android平台开发经验,熟悉Android架构;
> 3. 对研究和探索新技术有浓厚兴趣;
> 4. 具备良好的职业素养和团队协作精神,以及较强的学习能力,能够承担工作压力;
> 四、工作地点:北京
> 五、联系方式:有意者请发简历至 an...@andlisoft.com
>
> --
> 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

Re: [android-developers] Re: How to display a raw YUV frame in an Android OpenGL program?

2010-12-06 Thread
I have not fixed it now.I think that the driver maybe change Liumince
to BGRA when Upload texture,so it is very slow.

在 2010年12月5日 上午2:12,Nilly  写道:
> Yes same thing is happening for me.
>
> I have also written program in opengles 2.0 and uploading texture yuv
> is taking around 54ms and rendering is taking 20 ms.
>
> 640*480.
>
> But what i feel is this is blocking cpu but i dont know how to do all
> of that in gpu or second option is that all this is happening in
> software.
>
> regards,
> Niral
>
> On Nov 5, 12:57 am, 袁堂夫  wrote:
>> thanks for your response, yes, our frame is from a live camera, so it
>> changes dynamically.
>> as what you said, we passed YUV frame to the GPU, and do the YUV to
>> RGB convert in the GPU side (we used matrix-vector multiplication).
>>
>> My questions are:
>> 1) Does the GPU convert blocks the CPU?
>> 2) if the first answer is "no", then why transmit a 600*300 image from
>> CPU to GPU caused about 40ms in the nexus one (1G CPU)? we used
>> glTexImage2D to pass the Y,U,V data to the GPU.
>>
>> 2010/11/4 ChrisAR :
>>
>>
>>
>>
>>
>>
>>
>> > I need a little bit more of information before I can answer this
>> > properly. Is your raw YUV frame being passed to the GPU as an OpenGL
>> > ES texture? Is this YUV frame a static image, or it changes
>> > dynamically (like, is it being captured from a live videocamera in
>> > real time)?
>>
>> > Doing the math to (a) properly scale your data ([0...256] to
>> > [0.0...1.0], or whatever range you need) is trivial, then (b)
>> > converting from YUV to RGB is simple enough (http://en.wikipedia.org/
>> > wiki/Yuv#Converting_between_Y.27UV_and_RGB), and then fitting the
>> > result into an appropriate OpenGL texture format is easy.
>>
>> > The decision you need to make is when you will perform this math. If
>> > it is a static frame (it doesn't change frequently), you can just do
>> > it in the CPU; this is the easy case.The tricky part is if your YUV is
>> > supposed to change frequently. If this is the case, then:
>> > -If your demo is in OpenGL ES 2.0, this is not too bad. You could
>> > update the OpenGL texture with your new YUV frame, and then use a GLSL
>> > ES fragment shader to do the math. You will need to be careful so it
>> > is optimized. Keep in mind that most OpenGL ES 2.0 mobile GPUs out
>> > there aren't very friendly to fragment-shader-intensive operations in
>> > terms of performance. I have done this in the past, and it is not hard
>> > to do at all (just a matrix-vector multiplication!)
>> > -If your demo is in OpenGL ES 1.x, or if your fragment shader is too
>> > slow, then you should look into optimizing your CPU conversion.
>> > Possibly look at ARM NEON extensions and see if that would speed your
>> > math (if your platform supports NEON, since not all ARM licensees have
>> > it).
>>
>> > On Nov 3, 10:26 pm, 袁堂夫  wrote:
>> >> I think the FBO does not surppot  YUV format texture,so do you have
>> >> some good idea?
>>
>> > --
>> > 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

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


[android-developers] how to set the SeekBar more narrow?

2010-11-30 Thread
how to  set the SeekBar  more narrow and the thumb is still that big?

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


[android-developers] glTexImage2D is too slow,who can help me,please

2010-11-18 Thread
when draw YUV frame use opengl 2.0 and shader on nexus one,but the
function  glTexImage2D is too slow ,cost 40-60 ms
who can fix it ? the key codes:
-

int CreateSimpleTexture2D()
   {
   int err, i;



   for (i=0; i<3;i++)
   {
   glGenTextures(1, &userData.textureId[i]);
   if (err = glGetError()) {
   //  NSLog(@"Error: Could not generate
texture: %d", err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not generate texture: %d", err);
   return 0;
   }

   glBindTexture(GL_TEXTURE_2D, userData.textureId[i]);
   if (err = glGetError()) {
   //  NSLog(@"Error: Could not bind texture: %d", err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not bind texture: %d", err);
   return 0;
   }
   }

   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
   if (err = glGetError()) {
   //NSLog(@"Error: Could not set texture
minimization filter: %d", err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not set texture minimization filter: %d", err);
   return 0;
   }

   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   if (err = glGetError()) {
   //  NSLog(@"Error: Could not set texture
magnification filter: %d", err);
   
__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not set texture magnification filter: %d", err);
   return 0;
   }

   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_EDGE);
   glGenerateMipmap(GL_TEXTURE_2D);
   return 1;
   }


---render frame
-
   glViewport ( 0, 0, g_WindowsWidth, g_WindowsHeight );
   checkGlError("glViewport");
   //glDrawBuffer(GL_COLOR_ATTACHMENT0);
   // Clear the color buffer
   glClear ( GL_COLOR_BUFFER_BIT );
   checkGlError("glClear");
   // Use the program object
   glUseProgram ( userData.programObject );
   checkGlError("glUseProgram");
   // Load the vertex position
   glVertexAttribPointer ( userData.positionLoc, 3, GL_FLOAT,
  GL_FALSE, 5
* sizeof(GLfloat), vVertices );
   // Load the texture coordinate
   glVertexAttribPointer ( userData.texCoordLoc, 2, GL_FLOAT,
  GL_FALSE, 5
* sizeof(GLfloat), &vVertices[3] );

   glEnableVertexAttribArray ( userData.positionLoc );
   glEnableVertexAttribArray ( userData.texCoordLoc );

   long long  ttt=av_gettime();
   // Bind the texture
   glActiveTexture ( GL_TEXTURE1 );
   glBindTexture ( GL_TEXTURE_2D, userData.textureId[1] );
   glUniform1i ( userData.samplerLocU, 1);
   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);
   //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
   //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
   //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

   //glPixelStorei(GL_UNPACK_ALIGNMENT,1);

   glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width/2,
height/2, 0,
GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[1]);
   checkGlError("glTexImage2Dpict->data[1]");
   //glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width*0.5,
height*0.5, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[1]);


   // Bind the texture
   glActiveTexture ( GL_TEXTURE2 );
   glBindTexture ( GL_TEXTURE_2D, userData.textureId[2] );
   glUniform1i ( userData.samplerLocV, 2);
   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);

Re: [android-developers] Who is familiar with the Opengl es 2.0?

2010-11-17 Thread
I use opengl es 2.0 to draw some picture,and create the FBOs,
but how to present the renderbuffer on the screen?
--code like this

   glGenFramebuffers(1, &viewFramebuffer);
   glGenRenderbuffers(1, &viewRenderbuffer);
   glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer);
   glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
   glRenderbufferStorage (GL_RENDERBUFFER, GL_RGB565,
g_WindowsWidth,
g_WindowsHeight);
   glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, viewRenderbuffer);
   GLenum status=glCheckFramebufferStatus(GL_FRAMEBUFFER);
//draw something,like glTexImage
//but how to present the renderbuffer on the screen?

2010/11/17 TreKing :
> On Tue, Nov 16, 2010 at 2:16 AM, 袁堂夫  wrote:
>>
>> I want ask some questions about Opengl es 2.0?
>> Who can help me ?
>
> Why don't you just ask the questions you have and see if anyone knows the
> answer(s)?
> Or try Google.
>
> -
> TreKing - Chicago transit tracking app for Android-powered devices
>
> --
> 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


[android-developers] how to present the renderbuffer on the screen?

2010-11-16 Thread
I use opengl es 2.0 to draw some picture,and create the FBOs,
but how to present the renderbuffer on the screen?
--code like this

glGenFramebuffers(1, &viewFramebuffer);
glGenRenderbuffers(1, &viewRenderbuffer);
glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer);
glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
glRenderbufferStorage (GL_RENDERBUFFER, GL_RGB565, 
g_WindowsWidth,
g_WindowsHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, viewRenderbuffer);
GLenum status=glCheckFramebufferStatus(GL_FRAMEBUFFER);
 //draw something,like glTexImage
 //but how to present the renderbuffer on the screen?

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


[android-developers] Who is familiar with the Opengl es 2.0?

2010-11-16 Thread
I want ask some questions about Opengl es 2.0?
Who can help me ?

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


[android-developers] who can give me some example to show how to use EGLimage?

2010-11-15 Thread
who can give me some example to show how to use EGLimage?
please help me, thank you!

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


[android-developers] glTexImage2D is too slow,

2010-11-15 Thread
> when draw YUV frame use opengl 2.0 and shader on nexus one,but the
> function  glTexImage2D is too slow ,cost 40-60 ms
> who can fix it ?I want know whether EGLimage can fix it,but I do not know how 
> use EGLimage,who can give me some examples?
   the key codes:
> -
>
> int CreateSimpleTexture2D()
> {
> int err, i;
>
> for (i=0; i<3;i++)
> {
> glGenTextures(1, &userData.textureId[i]);
> if (err = glGetError()) {
> //  NSLog(@"Error: Could not generate texture: 
> %d", err);
> 
> __android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
> Could not generate texture: %d", err);
> return 0;
> }
>
> glBindTexture(GL_TEXTURE_2D, userData.textureId[i]);
> if (err = glGetError()) {
> //  NSLog(@"Error: Could not bind texture: %d", 
> err);
> 
> __android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
> Could not bind texture: %d", err);
> return 0;
> }
> }
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
> GL_LINEAR);
> if (err = glGetError()) {
> //NSLog(@"Error: Could not set texture minimization 
> filter: %d", err);
> 
> __android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
> Could not set texture minimization filter: %d", err);
> return 0;
> }
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
> GL_LINEAR);
> if (err = glGetError()) {
> //  NSLog(@"Error: Could not set texture magnification 
> filter: %d", err);
> 
> __android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
> Could not set texture magnification filter: %d", err);
> return 0;
> }
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 
> GL_CLAMP_TO_EDGE);
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 
> GL_CLAMP_TO_EDGE);
> glGenerateMipmap(GL_TEXTURE_2D);
> return 1;
> }
>
> ---render frame
> -
> glViewport ( 0, 0, g_WindowsWidth, g_WindowsHeight );
> checkGlError("glViewport");
> //glDrawBuffer(GL_COLOR_ATTACHMENT0);
> // Clear the color buffer
> glClear ( GL_COLOR_BUFFER_BIT );
> checkGlError("glClear");
> // Use the program object
> glUseProgram ( userData.programObject );
> checkGlError("glUseProgram");
> // Load the vertex position
> glVertexAttribPointer ( userData.positionLoc, 3, GL_FLOAT,
>GL_FALSE, 5 * 
> sizeof(GLfloat), vVertices );
> // Load the texture coordinate
> glVertexAttribPointer ( userData.texCoordLoc, 2, GL_FLOAT,
>GL_FALSE, 5 * 
> sizeof(GLfloat), &vVertices[3] );
>
> glEnableVertexAttribArray ( userData.positionLoc );
> glEnableVertexAttribArray ( userData.texCoordLoc );
>
> long long  ttt=av_gettime();
> // Bind the texture
> glActiveTexture ( GL_TEXTURE1 );
> glBindTexture ( GL_TEXTURE_2D, userData.textureId[1] );
> glUniform1i ( userData.samplerLocU, 1);
> 
> 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);
> //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 
> GL_REPEAT);
> //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 
> GL_REPEAT);
> //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
>
> //glPixelStorei(GL_UNPACK_ALIGNMENT,1);
>
> glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width/2, 
> height/2, 0,
> GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[1]);
> checkGlError("glTexImage2Dpict->data[1]");
> //glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width*0.5,
> height*0.5, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[1]);
>
> // Bind the texture
> 

[android-developers] how to EGLimage?

2010-11-14 Thread
I use the glTexImage2D to draw YUV frame date,but it is too slowly.
so I want to use EGLimage to draw YUV frame,but it is not display.
Do I make any mistake?  Thank you!
---


glActiveTexture ( GL_TEXTURE1 );
glBindTexture ( GL_TEXTURE_2D, userData.textureId[1] );
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glUniform1i ( userData.samplerLocU, 1);

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

eglImage = pFnEGLCreateImageKHR(g_Display, 0,
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) pict->data[1], 0);
pFnEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage);
pFnEGLDestroyImageKHR(g_Display,eglImage);


// Bind the texture
glActiveTexture ( GL_TEXTURE2 );
glBindTexture ( GL_TEXTURE_2D, userData.textureId[2] );
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glUniform1i ( userData.samplerLocV, 2);

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

eglImage = pFnEGLCreateImageKHR(g_Display, 0,
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) pict->data[2], 0);
pFnEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage);
pFnEGLDestroyImageKHR(g_Display,eglImage);


glActiveTexture ( GL_TEXTURE0 );
glBindTexture ( GL_TEXTURE_2D, userData.textureId[0] );
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
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);

eglImage = pFnEGLCreateImageKHR(g_Display, 0,
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) pict->data[0], 0);
pFnEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage);
pFnEGLDestroyImageKHR(g_Display,eglImage);

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


[android-developers] how to use eglCreateImageKHR?

2010-11-10 Thread
I use Opengl 2.0 on android with nexues one,but I don't know how to
use eglimage.
Does any one have a example for me ? How do these  functiones  work?

eglCreateImageKHR
glEGLImageTargetTexture2DOES
eglDestroyImageKHR

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


[android-developers] glTexImage2D is too slow,why?

2010-11-07 Thread
when draw YUV frame use opengl 2.0 and shader on nexus one,but the
function  glTexImage2D is too slow ,cost 40-60 ms
who can fix it ? the key codes:
-

int CreateSimpleTexture2D()
{
int err, i;



for (i=0; i<3;i++)
{
glGenTextures(1, &userData.textureId[i]);
if (err = glGetError()) {
//  NSLog(@"Error: Could not generate texture: %d", 
err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not generate texture: %d", err);
return 0;
}

glBindTexture(GL_TEXTURE_2D, userData.textureId[i]);
if (err = glGetError()) {
//  NSLog(@"Error: Could not bind texture: %d", 
err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not bind texture: %d", err);
return 0;
}
}

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
GL_LINEAR);
if (err = glGetError()) {
//NSLog(@"Error: Could not set texture minimization 
filter: %d", err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not set texture minimization filter: %d", err);
return 0;
}

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
GL_LINEAR);
if (err = glGetError()) {
//  NSLog(@"Error: Could not set texture magnification 
filter: %d", err);

__android_log_print(ANDROID_LOG_ERROR,"CreateSimpleTexture2D","Error:
Could not set texture magnification filter: %d", err);
return 0;
}

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 
GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 
GL_CLAMP_TO_EDGE);
glGenerateMipmap(GL_TEXTURE_2D);
return 1;
}


---render frame
-
glViewport ( 0, 0, g_WindowsWidth, g_WindowsHeight );
checkGlError("glViewport");
//glDrawBuffer(GL_COLOR_ATTACHMENT0);
// Clear the color buffer
glClear ( GL_COLOR_BUFFER_BIT );
checkGlError("glClear");
// Use the program object
glUseProgram ( userData.programObject );
checkGlError("glUseProgram");
// Load the vertex position
glVertexAttribPointer ( userData.positionLoc, 3, GL_FLOAT,
   GL_FALSE, 5 * 
sizeof(GLfloat), vVertices );
// Load the texture coordinate
glVertexAttribPointer ( userData.texCoordLoc, 2, GL_FLOAT,
   GL_FALSE, 5 * 
sizeof(GLfloat), &vVertices[3] );

glEnableVertexAttribArray ( userData.positionLoc );
glEnableVertexAttribArray ( userData.texCoordLoc );

long long  ttt=av_gettime();
// Bind the texture
glActiveTexture ( GL_TEXTURE1 );
glBindTexture ( GL_TEXTURE_2D, userData.textureId[1] );
glUniform1i ( userData.samplerLocU, 1);
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);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

//glPixelStorei(GL_UNPACK_ALIGNMENT,1);

glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width/2, height/2, 
0,
GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[1]);
checkGlError("glTexImage2Dpict->data[1]");
//glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width*0.5,
height*0.5, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pict->data[1]);


// Bind the texture
glActiveTexture ( GL_TEXTURE2 );
glBindTexture ( GL_TEXTURE_2D, userData.textureId[2] );

Re: [android-developers] Re: How to display a raw YUV frame in an Android OpenGL program?

2010-11-05 Thread
thanks for your response, yes, our frame is from a live camera, so it
changes dynamically.
as what you said, we passed YUV frame to the GPU, and do the YUV to
RGB convert in the GPU side (we used matrix-vector multiplication).

My questions are:
1) Does the GPU convert blocks the CPU?
2) if the first answer is "no", then why transmit a 600*300 image from
CPU to GPU caused about 40ms in the nexus one (1G CPU)? we used
glTexImage2D to pass the Y,U,V data to the GPU.


2010/11/4 ChrisAR :
> I need a little bit more of information before I can answer this
> properly. Is your raw YUV frame being passed to the GPU as an OpenGL
> ES texture? Is this YUV frame a static image, or it changes
> dynamically (like, is it being captured from a live videocamera in
> real time)?
>
> Doing the math to (a) properly scale your data ([0...256] to
> [0.0...1.0], or whatever range you need) is trivial, then (b)
> converting from YUV to RGB is simple enough (http://en.wikipedia.org/
> wiki/Yuv#Converting_between_Y.27UV_and_RGB), and then fitting the
> result into an appropriate OpenGL texture format is easy.
>
> The decision you need to make is when you will perform this math. If
> it is a static frame (it doesn't change frequently), you can just do
> it in the CPU; this is the easy case.The tricky part is if your YUV is
> supposed to change frequently. If this is the case, then:
> -If your demo is in OpenGL ES 2.0, this is not too bad. You could
> update the OpenGL texture with your new YUV frame, and then use a GLSL
> ES fragment shader to do the math. You will need to be careful so it
> is optimized. Keep in mind that most OpenGL ES 2.0 mobile GPUs out
> there aren't very friendly to fragment-shader-intensive operations in
> terms of performance. I have done this in the past, and it is not hard
> to do at all (just a matrix-vector multiplication!)
> -If your demo is in OpenGL ES 1.x, or if your fragment shader is too
> slow, then you should look into optimizing your CPU conversion.
> Possibly look at ARM NEON extensions and see if that would speed your
> math (if your platform supports NEON, since not all ARM licensees have
> it).
>
> On Nov 3, 10:26 pm, 袁堂夫  wrote:
>> I think the FBO does not surppot  YUV format texture,so do you have
>> some good idea?
>
> --
> 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


[android-developers] How to display a raw YUV frame in an Android OpenGL program?

2010-11-03 Thread
I think the FBO does not surppot  YUV format texture,so do you have
some good idea?

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


[android-developers] how to draw the video frame 0f YUV420 as soon as possible?

2010-11-02 Thread
I use Opengl 2.0 and write shader  (nexes one). The only problem is
that glTexImage2D is too slowly,costing 40ms per frame.
So do you have good idea to fix it? Tell me,please. Thank you very much.


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);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
//glPixelStorei(GL_UNPACK_ALIGNMENT,1);


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


Re: [android-developers] Re: glTexImage2D is too slow

2010-11-02 Thread
thanks for your response, as we have data in YUV format, so we use
GL_LUMINANCE texture to transmit the YUV data to the GPU, then convert
the YUV data to RGB data in the GPU. we have found that it costs
nearly 40 ms to display a 600*300 video frame.
My question is:
1) I think the YUV to RGB convertion should not occupy the CPU time,
as it is completed in the GPU. but seems that it also blocks the CPU?
2) if the first answer is no, then transmit the 600*300 YUV data to
GPU cost 40 ms?


2010/11/2 cybice :
> 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, 袁堂夫  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 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


[android-developers] how to use Opengl 2.0 on android?

2010-11-01 Thread
how to do with the framebuffer and  renderbuffer?

when we develop on iphone the  function "presentRenderbuffe"  is
working.but on android ,how to display the renderbuffer?
 (![context presentRenderbuffer:GL_RENDERBUFFER])

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


[android-developers] glTexImage2D is too slow

2010-11-01 Thread
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 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