Android ApiDemos示例解析(205):Graphics->OpenGL ES->Translucent GLSurfaceView
来源:互联网 发布:冬庆线切割怎么编程 编辑:程序博客网 时间:2024/06/05 17:32
本例介绍使用透明背景绘制OpenGL 图形。步骤如下:
1. 对于Activity使用透明主题
<activity android:name=”.graphics.TranslucentGLSurfaceViewActivity”
android:label=”Graphics/OpenGL ES/Translucent GLSurfaceView”
android:theme=”@style/Theme.Translucent”
android:configChanges=”keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize”>
<intent-filter>
< action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.SAMPLE_CODE” />
< /intent-filter>
< /activity>
2. 使用8888 (RGBA) 格式,Alpha通道是显示透明图形必需的。
// We want an 8888 pixel format because that's required for// a translucent window.// And we want a depth buffer.mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
3. 为GLSurfaceView指定Alpha通道
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
4. 为绘制的图行背景为颜色(0,0,0,0)
gl.glClearColor(0,0,0,0);
最后刚发现在CSDN的博客被提名到”2012CSDN博客之星“。
希望喜欢本博客的朋友投我一票, 谢谢: http://vote.blog.csdn.net/item/blogstar/mapdigit
- Android ApiDemos示例解析(205):Graphics->OpenGL ES->Translucent GLSurfaceView
- Android ApiDemos示例解析(203):Graphics->OpenGL ES->GLSurfaceView
- Android ApiDemos示例解析(200):Graphics->OpenGL ES->Textured Triangle
- Android ApiDemos示例解析(201):Graphics->OpenGL ES->Compressed Texture
- Android ApiDemos示例解析(202):Graphics->OpenGL ES->Cube Map
- Android ApiDemos示例解析(200):Graphics->OpenGL ES->Textured Triangle
- Android OpenGL ES->Translucent GLSurfaceView
- Android ApiDemos示例解析(204):Graphics->OpenGL ES->Frame Buffer Object
- Android ApiDemos示例解析(16):App->Activity->Translucent
- Android ApiDemos示例解析(17):App->Activity->Translucent Blur
- Android ApiDemos示例解析(77):Graphics->RoundRects
- Android ApiDemos示例解析:Graphics->Layers
- Android ApiDemos示例解析(55):Graphics->BitmapMesh
- Android ApiDemos示例解析(56):Graphics->BitmapPixels
- Android ApiDemos示例解析:Graphics->Layers
- Android ApiDemos示例解析(51):Graphics->AlphaBitmap
- Android ApiDemos示例解析(52):Graphics->AnimateDrawables
- Android ApiDemos示例解析(53):Graphics->Arcs
- 使用awk按表格格式化显示
- [Ubuntu]: Ubuntu 10.04 LTS中安装ACE wrappers 5.8
- Google Play开发者账号注册教程
- js 输入控制技巧
- 跨站测试与利用中的绕过技术
- Android ApiDemos示例解析(205):Graphics->OpenGL ES->Translucent GLSurfaceView
- Android的文本和输入---复制和粘贴(三)
- Google search skill
- extern "C"
- How to store node content in Drupal
- ORA-01791:不是SElECTed表达式
- 深入浅出—设计模式重要原则
- 5个砝码
- Qt 坐标系统