[android-developers] Re: opengl display issue when using g.getHolder().setFormat(PixelFormat.RGBA_8888);

2009-04-25 Thread Jon Colverson

On Apr 25, 9:54 pm, William  wrote:
> Ok, so I wanted to create a transparent activity where I draw some
> cubes on the screen.  Well I initially was developing with the default
> settings where
>   g.getHolder().setFormat(PixelFormat.RGBA_);
> my view in a real narrow scope see below code for sample.
>
> when not setting a alpha channel. it works as expected.

As well as setting the SurfaceHolder format you need to tell EGL that
you want a matching config:
egl.eglChooseConfig(display, new int[] {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_ALPHA_SIZE, 8,
// No depth buffer:
EGL10.EGL_DEPTH_SIZE, 0,
EGL10.EGL_NONE
}, configs, configs.length, new int[1]);

Unfortunately, when you done that you'll probably run into issue 1963:
http://code.google.com/p/android/issues/detail?id=1963

I don't have a solution for that one.

--
Jon

--~--~-~--~~~---~--~~
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] Re: opengl display issue when using g.getHolder().setFormat(PixelFormat.RGBA_8888);

2009-04-25 Thread William

I forgot an interesting tid bit of information.  There is not issue/
difference on the emulator when i use or dont use the alpha channel.
the issue only occurs on the actual phone

On Apr 25, 4:54 pm, William  wrote:
> Ok, so I wanted to create a transparent activity where I draw some
> cubes on the screen.  Well I initially was developing with the default
> settings where
>   g.getHolder().setFormat(PixelFormat.RGBA_);
> my view in a real narrow scope see below code for sample.
>
> when not setting a alpha channel. it works as expected.
>
> when using
>   g.getHolder().setFormat(PixelFormat.RGBA_);
> it causes me to zoom way out where my objects are really really small
> like 1/80th the screen AND i end up with dual view.  where the screen
> is divided evenly in two where the objects are drawn two times in each
> view.
>
> whats going on?
>
> CODE...
>
> //i write directly to my actvitiy my surface view not using a
> layout.xml file
> g =new MySurfaceView(this,this.ballContext);
>                 g.setFocusable(true);
>                 v = g;
>                 setContentView((View)v);
>                 // Use a surface format with an Alpha channel:
>         g.getHolder().setFormat(PixelFormat.RGBA_);
>
> when i glu my look at
> GLU.gluLookAt(gl, 0, 0, 3,0,0,0, 0,1,0);
>
> and my objects get drawn at a -7 depth into the screen.  so not very
> far away. they are maybe 1/8 the screen when not using the alpha
> format
> float zOffset = -7.0f;
>
> initial gl set up
>                gl.glEnable(GL10.GL_LIGHTING);
>                 gl.glEnable(GL10.GL_LIGHT0);
>                 gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, 
> matAmbient,
> 0);
>                 gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, 
> matDiffuse,
> 0);
>
>                 gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lightAmbient,   
>   0);
>                 gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightDiffuse,   
>   0);
>                 gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPos, 0);
>
>                 gl.glEnable(GL10.GL_DEPTH_TEST);
>                 gl.glDepthFunc(GL10.GL_LEQUAL);
>
>                 gl.glEnable(GL10.GL_TEXTURE_2D);
>
>                 gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
>                 gl.glClearDepthf(1.0f);
>
>                 gl.glVertexPointer(3, GL10.GL_FLOAT, 0, cubeBuff);
>                 gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
>                 gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texBuff);
>                 gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
>
>                 gl.glEnable(GL10.GL_CULL_FACE);
>                 gl.glShadeModel(GL10.GL_SMOOTH);
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---