我希望从我的drawable资源文件夹中设置一个静态图像作为我的OpenGL动画的背景。当动画位于GLSurfaceView
时,我尝试将GLSurfaceView
的背景设置为可绘制资源,但这不起作用。
<android.opengl.GLSurfaceView
android:id="@+id/graphics_glsurfaceview1"
android:layout_width="fill_parent"
android:layout_height="500dp"
android:background="@drawable/background" />
我想如何为我的OpenGL动画设置背景图像。我的onSurfaceCreated
课程有onDrawFrame
,onSurfaceChanged
,GLSurfaceView
方法,所以可能在某处?
答案 0 :(得分:1)
这不会奏效。你需要这样做:
GLSurfaceView
这样你就会看到你的背景。
您可以在Android API演示中查看此示例,请查看TranslucentGLSurfaceViewActivity
。要查看它,请启动API演示应用程序并选择 Graphics-&gt; OpenGL ES-&gt; Translucent GLSurfaceView 。
但是,我强烈建议不要以这种方式绘制背景,但使用OpenGL意味着 - 加载纹理并绘制它。