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