Reputation: 509
My intention is to place an background image for a rendering cube.for that i need to make my GLSurfaceView as translucent, i tried APIDemos example,it give me how to make entire activity as translucent which is not my intention. GLSurfaceViewObject.setZorderOnTop(true) statement worked fine but this method was not available till Android 2.1. Is there any alternative way for setZOrderOnTop(true) in Android 1.6 SDK?or is there any other way to make GLSurfaceView as translucent?
Upvotes: 0
Views: 317
Reputation: 162164
Why not simply draw a viewport filling textured quad as background? As in:
glViewport(0,0,w,h);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,1,0,1,-1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
GLfloat verts[8] = {0,0, 1,0, 1,1, 0,1};
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, verts);
glTexCoordPointer(2, GL_FLOAT, 0, verts);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
YOUR_PROJECTION();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
YOUR_MODELVIEW();
DRAW_YOUR_SCENE();
Upvotes: 1