Hi

I have a layout with two fullscreen views on top of each other. The
bottom view just shows a .png picture. The top view shows some OpenGL
rendered graphics. When some translucent objects on the top view moves
over a non-black area of the bottom view, blending is real bad
- example1: blue in bottom view and translucent yellow/red (fire) in
top view, turns out to be shiny green!?!)
- example2: gray in bottom view and translucent yellow/red (fire) in
top view, also turns out to be shiny green!?!)
How can I improve???
Blending internally in the top view (OpenGL) works fine.

Selected code:

Bottom view:
Fields
  private Bitmap mBackgroundImage;
  private SurfaceHolder mSurfaceHolder;
In view constructor:
  mSurfaceHolder = getHolder();
  mBackgroundImage = BitmapFactory.decodeResource(res,
R.drawable.mypic);
In doDraw
  Canvas c = mSurfaceHolder.lockCanvas(null);
  c.drawBitmap(mBackgroundImage, 0, 0, null);

Top view:
Fields
  EGL10 mEgl;
  EGLDisplay mEglDisplay;
  EGLSurface mEglSurface;
  EGLConfig mEglConfig;
  EGLContext mEglContext;
Initializing:
  int[] configSpec = {
                        EGL10.EGL_RED_SIZE,      8,
                        EGL10.EGL_GREEN_SIZE,    8,
                        EGL10.EGL_BLUE_SIZE,     8,
                        EGL10.EGL_ALPHA_SIZE,    8,
                        EGL10.EGL_DEPTH_SIZE,   16,
                        EGL10.EGL_NONE
                };
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
  int[] version = new int[2];
  mEgl.eglInitialize(mEglDisplay, version);
  EGLConfig[] configs = new EGLConfig[1];
  int[] num_config = new int[1];
  mEgl.eglChooseConfig(mEglDisplay, configSpec, configs, 1,
num_config);
  mEglConfig = configs[0];
  mEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig,
EGL10.EGL_NO_CONTEXT, null);
  mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay, mEglConfig,
holder, null);
  mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
mEglContext);
In doDraw:
  < do the OpenGL drawing >
  mEgl.eglSwapBuffers(mEglDisplay, mEglSurface);




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

Reply via email to