Android - 使用 opengl 为应用程序创建动画背景

标签 android opengl-es

我正在开发一个主要是 TextView 和按钮的应用程序,看起来没什么特别令人兴奋的。我想创建一个带有 3D 对象移动、改变颜色等的动画背景。实现这个的好方法是什么?我知道一些简单的 opengl,比如创建形状和做所有这些。有没有我可以添加到我的 xml 布局并将其设置为我的动画的 View ?任何帮助将不胜感激。

最佳答案

Here是android和opengl-es的指南。基本上你有

    <android.opengl.GLSurfaceView 
        android:id="@+id/graphics_glsurfaceview1" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">
    </android.opengl.GLSurfaceView>

然后在你的 onCreate 中,你给它一个 Renderer 的实现。 :

public class GraphicsRenderer implements Renderer {

    // implement Renderer. This is where all the openGL stuff goes

}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);   

    setContentView(R.layout.main);

    GLSurfaceView mGLView = (GLSurfaceView) findViewById(R.id.graphics_glsurfaceview1);
    mGLView.setEGLConfigChooser(true);         
    mGLView.setRenderer(graphicsRenderer);

}

关于Android - 使用 opengl 为应用程序创建动画背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8176560/

相关文章:

java - 什么时候初始化 Activity 的实例变量?

android - 如何获取 Onyx ibeacons 的电池电量

android - 如何在短信APP中添加字符计数器?

ios - 如何在 OpenGL es 2.0 中模拟累积缓冲区(尾随粒子效应)

ios - 改变 alpha 会改变颜色

android - 如何执行 graph-api Facebook Android SDK

php - 如何使用 volley 删除 recyclerview 中的项目?

android - 如何在 OpenGL ES 2 中正确缩放

android - libgdx - 着色器忽略第一帧中的混合/alpha

iOS GLKit 纹理在视网膜显示屏上模糊