I want to put a translucent 3D view on top of a 2D view (so that I can "fly" 
some 3D objects across my 2D view). I modified the 
TranslucentGLSurfaceViewActivity example in ApiDemo -- I created a full screen 
2D custom view that fills the screen in blue color. Then, I have a smaller 3D 
view on top of it that draws the cubes. However, in the 3D view instead of 
showing blue as the BG, it shows the contents of the Activity beneath. See the 
attached picture.
 
What did I do wrong?
 
Thanks
 
--------------add to AndroidManifest.xml
        <activity android:name=".graphics.TranslucentGLSurfaceViewActivity2"
                android:label="Graphics/OpenGL ES/Translucent GLSurfaceView2"
                android:theme="@style/Theme.Translucent"
                android:configChanges="orientation|keyboardHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.SAMPLE_CODE" />
            </intent-filter>
        </activity>
------------------TranslucentGLSurfaceViewActivity2.java
package com.example.android.apis.graphics;
import android.app.Activity;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
public class TranslucentGLSurfaceViewActivity2 extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View lowerView = new LowerView(this);
        mGLSurfaceView = new GLSurfaceView(this);
        mGLSurfaceView.setRenderer(new CubeRenderer(true));
        mGLSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);
        setContentView(lowerView);
        addContentView(mGLSurfaceView, new ViewGroup.LayoutParams(300, 300));
    }
    protected void onResume() {
        super.onResume();
        mGLSurfaceView.onResume();
    }
    protected void onPause() {
        super.onPause();
        mGLSurfaceView.onPause();
    }
    private GLSurfaceView mGLSurfaceView;
    class LowerView extends View {
        public LowerView(Context context) {
            super(context);
        }
        public void onDraw(Canvas canvas) {
            Rect rect = canvas.getClipBounds();
            Paint paint = new Paint();
            canvas.drawColor(Color.BLUE);
        }
    }
}
----------------------------------------------------
 
 


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

<<inline: glbug.png>>

Reply via email to