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


Java GLES30.glClear方法代码示例

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


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

示例1: onDrawFrame

import android.opengl.GLES30; //导入方法依赖的package包/类
public void onDrawFrame ( GL10 glUnused )
{
   // Set the viewport
   GLES30.glViewport ( 0, 0, mWidth, mHeight );

   // Clear the color buffer
   GLES30.glClear ( GLES30.GL_COLOR_BUFFER_BIT );

   // Use the program object
   GLES30.glUseProgram ( mProgramObject );

   // Set the vertex color to red
   GLES30.glVertexAttrib4f ( 0, 1.0f, 0.0f, 0.0f, 1.0f );

   // Load the vertex position
   mVertices.position ( 0 );
   GLES30.glVertexAttribPointer ( 1, 3, GLES30.GL_FLOAT,
                                  false,
                                  0, mVertices );

   GLES30.glEnableVertexAttribArray ( 1 );

   GLES30.glDrawArrays ( GLES30.GL_TRIANGLES, 0, 3 );

   GLES30.glDisableVertexAttribArray ( 1 );
}
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:27,代码来源:Example6_3Renderer.java

示例2: onDrawEye

import android.opengl.GLES30; //导入方法依赖的package包/类
/**
 * Draws a frame for an eye.
 *
 * @param eye The eye to render. Includes all required transformations.
 */
@Override
public void onDrawEye(Eye eye) {
    // Clear the color buffer  set above by glClearColor.
    GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);

    //need this otherwise, it will over right stuff and the cube will look wrong!
    GLES30.glEnable(GLES30.GL_DEPTH_TEST);

    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);

    // combine the model with the view matrix to create the modelview matreix
    Matrix.multiplyMM(modelview, 0, view, 0, mRotationMatrix, 0);

    // combine the model-view with the projection matrix
    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);

    //finally draw the cube with the full Model-view-projection matrix.
    mCube.draw(mMVPMatrix);

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

示例3: onDrawFrame

import android.opengl.GLES30; //导入方法依赖的package包/类
public void onDrawFrame(GL10 glUnused) {
    // Set the viewport
    GLES30.glViewport(0, 0, mWidth, mHeight);

    // Clear the color buffer, which was set above in glClearColor
    GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT);

    // Use the program object
    GLES30.glUseProgram(mProgramObject);

    // Load the vertex data
    GLES30.glVertexAttribPointer(0, 3, GLES30.GL_FLOAT, false, 0, mVertices);
    //set the starting vertex at 0.
    GLES30.glEnableVertexAttribArray(0);

    //actually draw the traingle here
    GLES30.glDrawArrays(GLES30.GL_TRIANGLES, 0, 3);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:19,代码来源:HelloTriangleRenderer.java

示例4: onDrawFrame

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 glUnused) 
{
	GLES30.glClear(GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);			        
               
       // Do a complete rotation every 10 seconds.
       long time = SystemClock.uptimeMillis() % 10000L;
       float angleInDegrees = (360.0f / 10000.0f) * ((int) time);
       
       // Draw the triangle facing straight on.
       Matrix.setIdentityM(mModelMatrix, 0);
       Matrix.rotateM(mModelMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);        
       drawTriangle(mTriangle1Vertices);
       
       // Draw one translated a bit down and rotated to be flat on the ground.
       Matrix.setIdentityM(mModelMatrix, 0);
       Matrix.translateM(mModelMatrix, 0, 0.0f, -1.0f, 0.0f);
       Matrix.rotateM(mModelMatrix, 0, 90.0f, 1.0f, 0.0f, 0.0f);
       Matrix.rotateM(mModelMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);        
       drawTriangle(mTriangle2Vertices);
       
       // Draw one translated a bit to the right and rotated to be facing to the left.
       Matrix.setIdentityM(mModelMatrix, 0);
       Matrix.translateM(mModelMatrix, 0, 1.0f, 0.0f, 0.0f);
       Matrix.rotateM(mModelMatrix, 0, 90.0f, 0.0f, 1.0f, 0.0f);
       Matrix.rotateM(mModelMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);
       drawTriangle(mTriangle3Vertices);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:29,代码来源:LessonOneRenderer.java

示例5: onDrawFrame

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 glUnused) {
    // Clear the color buffer  set above by glClearColor.
    GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);

    //need this otherwise, it will over right stuff and the cube will look wrong!
    GLES30.glEnable(GLES30.GL_DEPTH_TEST);

    // Set the camera position (View matrix)  note Matrix is an include, not a declared method.
    Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

    // Create a rotation and translation for the cube
    Matrix.setIdentityM(mRotationMatrix, 0);

    //move the cube up/down and left/right
    Matrix.translateM(mRotationMatrix, 0, mTransX, mTransY, 0);

    //mangle is how fast, x,y,z which directions it rotates.
    Matrix.rotateM(mRotationMatrix, 0, mAngle, 0.4f, 1.0f, 0.6f);

    // combine the model with the view matrix
    Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mRotationMatrix, 0);

    // combine the model-view with the projection matrix
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

    mPyramid.draw(mMVPMatrix);

    //change the angle, so the cube will spin.
    mAngle+=.4;
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:32,代码来源:myRenderer.java

示例6: onDrawFrame

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 unused) {
    float[] scratch = new float[16];

    // Draw background color
    GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);

    // Set the camera position (View matrix)
    Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

    // Calculate the projection and view transformation
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mViewMatrix, 0);

    // Draw square
    mSquare.draw(mMVPMatrix);

    // Create a rotation for the triangle

    // Use the following code to generate constant rotation.
    // Leave this code out when using TouchEvents.
    // long time = SystemClock.uptimeMillis() % 4000L;
    // float angle = 0.090f * ((int) time);

    Matrix.setRotateM(mRotationMatrix, 0, mAngle, 0, 0, 1.0f);

    // Combine the rotation matrix with the projection and camera view
    // Note that the mMVPMatrix factor *must be first* in order
    // for the matrix multiplication product to be correct.
    Matrix.multiplyMM(scratch, 0, mMVPMatrix, 0, mRotationMatrix, 0);

    // Draw triangle
    mTriangle.draw(scratch);
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:34,代码来源:MyGLRenderer.java

示例7: onDrawEye

import android.opengl.GLES30; //导入方法依赖的package包/类
/**
 * Draws a frame for an eye.
 *
 * @param eye The eye to render. Includes all required transformations.
 */
@Override
public void onDrawEye(Eye eye) {
    // Clear the color buffer  set above by glClearColor.
    GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);

    //need this otherwise, it will over right stuff and the cube will look wrong!
    GLES30.glEnable(GLES30.GL_DEPTH_TEST);

    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);

    // Set the position of the light
    Matrix.multiplyMV(lightPosInEyeSpace, 0, view, 0, LIGHT_POS_IN_WORLD_SPACE, 0);

    // combine the model with the view matrix to create the modelview matreix
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix0, 0);

    // combine the model-view with the projection matrix
    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);

    //finally draw the cube with the full Model-view-projection matrix.
    mCube.draw(mMVPMatrix);

    //now create the mvp matrix for cube2 and then draw it.
    // combine the model with the view matrix to create the modelview matreix
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix1, 0);

    // combine the model-view with the projection matrix
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mPyramid.draw(mMVPMatrix);
    //now the next 5
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix2, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mPyramid.draw(mMVPMatrix);
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix3, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mCube.draw(mMVPMatrix);
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix4, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mCube.draw(mMVPMatrix);
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix5, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mCube.draw(mMVPMatrix);
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix6, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mPyramid.draw(mMVPMatrix);
    Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix7, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mPyramid.draw(mMVPMatrix);

    //now calculate for the floor
    Matrix.multiplyMM(modelview, 0, view, 0, modelFloor, 0);
    // combine the model-view with the projection matrix
    Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
    mFloor.drawFloor(mMVPMatrix, modelFloor, modelview, lightPosInEyeSpace);
}
 
开发者ID:JimSeker,项目名称:CardBoardVR,代码行数:63,代码来源:myStereoRenderer.java

示例8: glClear

import android.opengl.GLES30; //导入方法依赖的package包/类
@Override
public void glClear(int flags)
{
    Data.renderCallsThisFrame = 0;
    GLES30.glClear(flags);
}
 
开发者ID:sriharshachilakapati,项目名称:SilenceEngine,代码行数:7,代码来源:AndroidGraphicsDevice.java

示例9: onDrawFrame

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


        // Clear the color buffer  set above by glClearColor.
        GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);

        //need this otherwise, it will over right stuff and the cube will look wrong!
        GLES30.glEnable(GLES30.GL_DEPTH_TEST);

        // Set the camera position (View matrix)  note Matrix is an include, not a declared method.
        Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

        // Create a rotation and translation for the cube
        Matrix.setIdentityM(mRotationMatrix, 0);

        //move the cube up/down and left/right
        Matrix.translateM(mRotationMatrix, 0, mTransX, mTransY, 0);

        //mangle is how fast, x,y,z which directions it rotates.
        Matrix.rotateM(mRotationMatrix, 0, mAngle, 1.0f, 1.0f, 1.0f);

        // combine the model with the view matrix
        Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mRotationMatrix, 0);

        // combine the model-view with the projection matrix
        Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

        mCube.draw(mMVPMatrix);

        //change the angle, so the cube will spin.
        mAngle+=.4;

    }
 
开发者ID:JimSeker,项目名称:opengl,代码行数:34,代码来源:myRenderer.java

示例10: onDrawFrame

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

        // Clear the color buffer  set above by glClearColor.
        GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);

        //need this otherwise, it will over right stuff and the cube will look wrong!
        GLES30.glEnable(GLES30.GL_DEPTH_TEST);

        // Set the camera position (View matrix)  note Matrix is an include, not a declared method.
        Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

        // Create a rotation and translation for the cube
        Matrix.setIdentityM(mRotationMatrix, 0);

        //move the cube up/down and left/right
        Matrix.translateM(mRotationMatrix, 0, mTransX, mTransY, 0);

        //mangle is how fast, x,y,z which directions it rotates.
        Matrix.rotateM(mRotationMatrix, 0, mAngle, 1.0f, 1.0f, 1.0f);

        // combine the model with the view matrix
        Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mRotationMatrix, 0);

        // combine the model-view with the projection matrix
        Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

        mCube.draw(mMVPMatrix);

        //change the angle, so the cube will spin.
        mAngle+=.4;

    }
 
开发者ID:JimSeker,项目名称:opengl,代码行数:33,代码来源:myRenderer.java


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