How can I use transparent or translucent view effect?

by PcALeX » Mon, 04 May 2009 05:57:30 GMT


Sponsored Links
 Hi guys,
I am a newbie in android UI programming.
I want to create a custom SurfaceView for my own renderer.
And this view has a transparent/translucent effect with background.
I follow api demo sample code to create
TranslucentGLSurfaceViewActivity
and TranslucentGLSurfaceView, but render result is blank screen.

Could someone give an advise to solve this problem?

PcALeX

--~--~---------~--~----~------------~-------~--~----~



How can I use transparent or translucent view effect?

by PcALeX » Mon, 04 May 2009 11:07:13 GMT


 Thank you for your answer Raphael.
Yes, it is.
I do my test and experiment on 1.5 emulator.
That's mean if I want to see transparent/translucent effect,
I need to run my test application on G1?
Is there any other way to test our SurfaceView with transparent
or translucent effect?
Thanks again.

Alex





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Get scroll speed of a Listview

Ivan Soto Fernandez
Web Developer
http://ivansotof.com

--~--~---------~--~----~------------~-------~--~----~

2. opengl display issue when using g.getHolder().setFormat(PixelFormat.RGBA_8888);

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

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

3. Creditcard chargeback

4. Proper usage of object passing for TabActivity/TabHost

5. Help is needed to use the beagleboard as a USB device

6. Cross process cursor using AbstractWindowedCursor

7. Smooth scrolling in surfaceview possible?