Embed GLSurfaceView in complex layout

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Embed GLSurfaceView in complex layout

Postby nanye » Wed Dec 17, 2008 4:53 am

I want to embed GLSurfaceView( in ApiDemos ) in some complex layout. I found that any View under GLSurfaceView will not be displayed (includes the layout background), even I have enable the translucent feature of its Render.

The layout I used for test is:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <RelativeLayout
  5.  
  6.    xmlns:android="http://schemas.android.com/apk/res/android"
  7.  
  8.    android:orientation="vertical"
  9.  
  10.    android:background="#a0ff6600"
  11.  
  12.    android:layout_width="fill_parent"
  13.  
  14.    android:layout_height="fill_parent">
  15.  
  16.     <ImageView
  17.  
  18.         android:src="@drawable/icon"
  19.  
  20.         android:scaleType="center"
  21.  
  22.         android:layout_width="fill_parent"
  23.  
  24.         android:layout_height="fill_parent"/>
  25.  
  26.     <com.android.gltest.GLSurfaceView
  27.  
  28.         android:id="@+id/surface_view"  
  29.  
  30.         android:layout_width="fill_parent"
  31.  
  32.         android:layout_height="wrap_content"/>
  33.  
  34. </RelativeLayout>
  35.  
  36.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


And add codes in test activity (I used activity with translucent theme),
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         ...
  3.  
  4.        
  5.  
  6.         setContentView(R.layout.layout_test_surface_view);
  7.  
  8.  
  9.  
  10.         mGLSurfaceView = (GLSurfaceView) findViewById(R.id.surface_view);
  11.  
  12.         mGLSurfaceView.setRenderer(new CubeRenderer(true));
  13.  
  14.         mGLSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);
  15.  
  16.  
  17.  
  18.         ...
  19.  
  20.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


The ImageView cannot be seen. But if I change the order, put the ImageView above the GLSurfaceView, it works fine!
Modified xml is:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <RelativeLayout
  5.  
  6.    xmlns:android="http://schemas.android.com/apk/res/android"
  7.  
  8.    android:orientation="vertical"
  9.  
  10.    android:background="#a0ff6600"
  11.  
  12.    android:layout_width="fill_parent"
  13.  
  14.    android:layout_height="fill_parent">
  15.  
  16.     <com.android.gltest.GLSurfaceView
  17.  
  18.         android:id="@+id/surface_view"  
  19.  
  20.         android:layout_width="fill_parent"
  21.  
  22.         android:layout_height="wrap_content"/>
  23.  
  24.     <ImageView
  25.  
  26.         android:src="@drawable/icon"
  27.  
  28.         android:scaleType="center"
  29.  
  30.         android:layout_width="fill_parent"
  31.  
  32.         android:layout_height="fill_parent"/>
  33.  
  34. </RelativeLayout>
  35.  
  36.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


See the comparison of screenshots is attached below:
Image

So, is this the problem of incorrect using or configuring of GLSurfaceView or just the problem of implement of GLSurface itself?

Looking forward to your helps.
Attachments
na-compare.png
Comparison
na-compare.png (482.19 KiB) Viewed 2308 times
nanye
Junior Developer
Junior Developer
 
Posts: 12
Joined: Fri Apr 18, 2008 3:55 am

Top

Postby Jbeer » Wed Mar 11, 2009 10:33 am

Hi!

I would like to know how to put background images in the surfaceviews with OpenGL (GLSurfaceview).

Thanks in advance
Jbeer
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jul 22, 2008 8:07 am
Location: España

Postby ztsyed » Wed Mar 11, 2009 10:11 pm

Were you able to resolve translucency with opengl? I'm having same problem with it, and wonder if you found a workaround for it.

Thanks,

Zia
ztsyed
Freshman
Freshman
 
Posts: 2
Joined: Fri Feb 27, 2009 11:53 pm

Postby MrSnowflake » Wed Mar 11, 2009 10:14 pm

* This is NOT a tutorial! MOVED *
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests