当前位置: 首页>>代码示例>>Java>>正文


Java GLES30.glClearColor方法代码示例

本文整理汇总了Java中android.opengl.GLES30.glClearColor方法的典型用法代码示例。如果您正苦于以下问题:Java GLES30.glClearColor方法的具体用法?Java GLES30.glClearColor怎么用?Java GLES30.glClearColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLES30的用法示例。


在下文中一共展示了GLES30.glClearColor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(EGLConfig eglConfig) {
    mRotationMatrix = new float[16];
    camera = new float[16];
    view = new float[16];
    mMVPMatrix = new float[16];
    modelview = new float[16];
    headView = new float[16];
    forward = new float[3];

    GLES30.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); // Dark background so text shows up well.
    //initialize the cube code for drawing.
    mCube = new Cube();

    // Build the camera matrix
    Matrix.setLookAtM(camera, 0, 0.0f, 0.0f, CAMERA_Z, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);

    // Object first appears directly in front of user.
    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, 0, 0, -objectDistance);
}
 
开发者ID:JimSeker,项目名称:CardBoardVR,代码行数:22,代码来源:myStereoRenderer.java

示例2: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(EGLConfig eglConfig) {
    mRotationMatrix = new float[16];
    camera = new float[16];
    view = new float[16];
    mMVPMatrix = new float[16];
    modelview = new float[16];
    headView = new float[16];

    GLES30.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); // Dark background so text shows up well.
    //initialize the cube code for drawing.
    mCube = new Cube();

    // Object first appears directly in front of user.
    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, 0, 0, -objectDistance);
}
 
开发者ID:JimSeker,项目名称:CardBoardVR,代码行数:18,代码来源:myStereoRenderer.java

示例3: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 unused, EGLConfig config) {

    // Set the background frame color
    GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    mTriangle = new Triangle();
    mSquare   = new Square();
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:10,代码来源:MyGLRenderer.java

示例4: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
public void onSurfaceCreated ( GL10 glUnused, EGLConfig config )
{
   String vShaderStr =
      "#version 300 es                            \n" +
      "layout(location = 0) in vec4 a_color;      \n" +
      "layout(location = 1) in vec4 a_position;   \n" +
      "out vec4 v_color;                          \n" +
      "void main()                                \n" +
      "{                                          \n" +
      "    v_color = a_color;                     \n" +
      "    gl_Position = a_position;              \n" +
      "}";


   String fShaderStr =
      "#version 300 es            \n" +
      "precision mediump float;   \n" +
      "in vec4 v_color;           \n" +
      "out vec4 o_fragColor;      \n" +
      "void main()                \n" +
      "{                          \n" +
      "    o_fragColor = v_color; \n" +
      "}" ;

   // Load the shaders and get a linked program object
   mProgramObject = ESShader.loadProgram ( vShaderStr, fShaderStr );

   GLES30.glClearColor ( 1.0f, 1.0f, 1.0f, 0.0f );
}
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:30,代码来源:Example6_3Renderer.java

示例5: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
    //set the clear buffer color to light gray.
    GLES30.glClearColor(0.9f, .9f, 0.9f, 0.9f);
    //initialize the cube code for drawing.
    mPyramid = new Pyramid();
    //if we had other objects setup them up here as well.
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:9,代码来源:myRenderer.java

示例6: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {


        //set the clear buffer color to light gray.
        GLES30.glClearColor(0.9f, .9f, 0.9f, 0.9f);
        //initialize the cube code for drawing.
        mCube = new Cube();
        //if we had other objects setup them up here as well.
    }
 
开发者ID:JimSeker,项目名称:opengl,代码行数:10,代码来源:myRenderer.java

示例7: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(EGLConfig eglConfig) {
    CubeMatrix0 = new float[16];
    CubeMatrix1 = new float[16];
    CubeMatrix2 = new float[16];
    CubeMatrix3 = new float[16];
    CubeMatrix4 = new float[16];
    CubeMatrix5 = new float[16];
    CubeMatrix6 = new float[16];
    CubeMatrix7 = new float[16];
    camera = new float[16];
    view = new float[16];
    mMVPMatrix = new float[16];
    modelview = new float[16];
    headView = new float[16];
    modelFloor = new float[16];

    GLES30.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); // Dark background so text shows up well.
    //initialize the cube code for drawing.
    mCube = new Cube();
    mPyramid = new Pyramid();

    // Object first appears directly in front of user.  In front
    Matrix.setIdentityM(CubeMatrix0, 0);
    //                                X  Y  Z
    Matrix.translateM(CubeMatrix0, 0, 0, 0, -objectDistance);
    //front left
    Matrix.setIdentityM(CubeMatrix1, 0);
    Matrix.translateM(CubeMatrix1, 0, -objectDistance, 0, -objectDistance);
    //front right
    Matrix.setIdentityM(CubeMatrix2, 0);
    Matrix.translateM(CubeMatrix2, 0, objectDistance, 0, -objectDistance);
    //left
    Matrix.setIdentityM(CubeMatrix3, 0);
    Matrix.translateM(CubeMatrix3, 0, -objectDistance, 0, 0);
    //right
    Matrix.setIdentityM(CubeMatrix4, 0);
    Matrix.translateM(CubeMatrix4, 0, objectDistance, 0, 0);
    //back
    Matrix.setIdentityM(CubeMatrix5, 0);
    Matrix.translateM(CubeMatrix5, 0, 0, 0, objectDistance);
    //back left
    Matrix.setIdentityM(CubeMatrix6, 0);
    Matrix.translateM(CubeMatrix6, 0, -objectDistance, 0, objectDistance);
    //back right
    Matrix.setIdentityM(CubeMatrix7, 0);
    Matrix.translateM(CubeMatrix7, 0, objectDistance, 0, objectDistance);
    //floor object
    mFloor = new Floor();
    Matrix.setIdentityM(modelFloor, 0);
    Matrix.translateM(modelFloor, 0, 0, -floorDepth, 0); // Floor appears below user.

}
 
开发者ID:JimSeker,项目名称:CardBoardVR,代码行数:54,代码来源:myStereoRenderer.java

示例8: onSurfaceCreated

import android.opengl.GLES30; //导入方法依赖的package包/类
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
    String vShaderStr =
            "#version 300 es 			  \n"
                    + "in vec4 vPosition;           \n"
                    + "void main()                  \n"
                    + "{                            \n"
                    + "   gl_Position = vPosition;  \n"
                    + "}                            \n";
    //a red ise 1.0, 0.0, 0.0, 1.0  but I prefer blue.
    String fShaderStr =
            "#version 300 es		 			          	\n"
                    + "precision mediump float;					  	\n"
                    + "out vec4 fragColor;	 			 		  	\n"
                    + "void main()                                  \n"
                    + "{                                            \n"
                    + "  fragColor = vec4 ( 0.0, 0.0, 1.0, 1.0 );	\n"
                    + "}                                            \n";

    int vertexShader;
    int fragmentShader;
    int programObject;
    int[] linked = new int[1];

    // Load the vertex/fragment shaders
    vertexShader = LoadShader(GLES30.GL_VERTEX_SHADER, vShaderStr);
    fragmentShader = LoadShader(GLES30.GL_FRAGMENT_SHADER, fShaderStr);

    // Create the program object
    programObject = GLES30.glCreateProgram();

    if (programObject == 0) {
        return;
    }

    GLES30.glAttachShader(programObject, vertexShader);
    GLES30.glAttachShader(programObject, fragmentShader);

    // Bind vPosition to attribute 0
    GLES30.glBindAttribLocation(programObject, 0, "vPosition");

    // Link the program
    GLES30.glLinkProgram(programObject);

    // Check the link status
    GLES30.glGetProgramiv(programObject, GLES30.GL_LINK_STATUS, linked, 0);

    if (linked[0] == 0) {
        Log.e(TAG, "Error linking program:");
        Log.e(TAG, GLES30.glGetProgramInfoLog(programObject));
        GLES30.glDeleteProgram(programObject);
        return;
    }

    // Store the program object
    mProgramObject = programObject;

    //set the clear buffer color to white.
    GLES30.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:60,代码来源:HelloTriangleRenderer.java

示例9: glClearColor

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void glClearColor(float r, float g, float b, float a)
{
    GLES30.glClearColor(r, g, b, a);
}
 
开发者ID:sriharshachilakapati,项目名称:SilenceEngine,代码行数:6,代码来源:AndroidGraphicsDevice.java


注:本文中的android.opengl.GLES30.glClearColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。