當前位置: 首頁>>代碼示例>>Java>>正文


Java GLES20.glDisableVertexAttribArray方法代碼示例

本文整理匯總了Java中android.opengl.GLES20.glDisableVertexAttribArray方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glDisableVertexAttribArray方法的具體用法?Java GLES20.glDisableVertexAttribArray怎麽用?Java GLES20.glDisableVertexAttribArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glDisableVertexAttribArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
private void draw(float[] matrix, FloatBuffer vertexBuffer, FloatBuffer uvBuffer, ShortBuffer drawListBuffer, short[] indices) {
    texture.bindTexture(0);
    GLES20.glEnable(GLES20.GL_BLEND_COLOR);
    GLES20.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glDepthMask(false);
    int mPositionHandle = GLES20.glGetAttribLocation(SpriteKitGraphicTools.imageShaderProgram, "vPosition");
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    GLES20.glVertexAttribPointer(mPositionHandle, 3,
            GLES20.GL_FLOAT, false,
            0, vertexBuffer);
    int mTexCoordLoc = GLES20.glGetAttribLocation(SpriteKitGraphicTools.imageShaderProgram, "a_texCoord");
    GLES20.glEnableVertexAttribArray(mTexCoordLoc);
    GLES20.glVertexAttribPointer(mTexCoordLoc, 2, GLES20.GL_FLOAT,
            false,
            0, uvBuffer);
    int mtrxhandle = GLES20.glGetUniformLocation(SpriteKitGraphicTools.imageShaderProgram, "uMVPMatrix");
    GLES20.glUniformMatrix4fv(mtrxhandle, 1, false, matrix, 0);
    int mSamplerLoc = GLES20.glGetUniformLocation(SpriteKitGraphicTools.imageShaderProgram, "s_texture");
    GLES20.glUniform1i(mSamplerLoc, 0);
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, indices.length,
            GLES20.GL_UNSIGNED_SHORT, drawListBuffer);
    GLES20.glDisableVertexAttribArray(mPositionHandle);
    GLES20.glDisableVertexAttribArray(mTexCoordLoc);
    GLES20.glDisable(GLES20.GL_BLEND_COLOR);
}
 
開發者ID:sakkeerhussain,項目名稱:SpriteKit-Android,代碼行數:26,代碼來源:Sprite.java

示例2: onDrawFrame

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public int onDrawFrame(int textureId, FloatBuffer vertexBuffer, FloatBuffer textureBuffer) {
       GLES20.glUseProgram(mGLProgId);
       if(!isInitialized()) {
           return OpenGLUtils.NOT_INIT;
       }
       vertexBuffer.position(0);
       GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer);
       GLES20.glEnableVertexAttribArray(mGLAttribPosition);
       textureBuffer.position(0);
       GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);
       GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);
       GLES20.glUniformMatrix4fv(mTextureTransformMatrixLocation, 1, false, mTextureTransformMatrix, 0);
       
       if(textureId != OpenGLUtils.NO_TEXTURE){
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);
        GLES20.glUniform1i(mGLUniformTexture, 0);
       }
       
       GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
       GLES20.glDisableVertexAttribArray(mGLAttribPosition);
       GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
       GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
       return OpenGLUtils.ON_DRAWN;
   }
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:27,代碼來源:MagicCameraInputFilter.java

示例3: drawLight

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Draws a point representing the position of the light.
 */
private void drawLight()
{
	final int pointMVPMatrixHandle = GLES20.glGetUniformLocation(mPointProgramHandle, "u_MVPMatrix");
       final int pointPositionHandle = GLES20.glGetAttribLocation(mPointProgramHandle, "a_Position");
       
	// Pass in the position.
	GLES20.glVertexAttrib3f(pointPositionHandle, mLightPosInModelSpace[0], mLightPosInModelSpace[1], mLightPosInModelSpace[2]);

	// Since we are not using a buffer object, disable vertex arrays for this attribute.
       GLES20.glDisableVertexAttribArray(pointPositionHandle);  
	
	// Pass in the transformation matrix.
	Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mLightModelMatrix, 0);
	Matrix.multiplyMM(mTemporaryMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);
	System.arraycopy(mTemporaryMatrix, 0, mMVPMatrix, 0, 16);
	GLES20.glUniformMatrix4fv(pointMVPMatrixHandle, 1, false, mMVPMatrix, 0);
	
	// Draw the point.
	GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 1);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:24,代碼來源:LessonSixRenderer.java

示例4: render

import android.opengl.GLES20; //導入方法依賴的package包/類
public void render(int shaderProgram, String posAttributeName, String colAttributeName) {
    int positionHandle = GLES20.glGetAttribLocation(shaderProgram, posAttributeName);
    GLES20.glVertexAttribPointer(positionHandle, 3,
            GLES20.GL_FLOAT, false,
            3 * 4, vertexBuffer);

    int colorHandle = GLES20.glGetAttribLocation(shaderProgram, colAttributeName);
    GLES20.glVertexAttribPointer(colorHandle, 4,
            GLES20.GL_FLOAT, false,
            4 * 4, colorBuffer);


    GLES20.glEnableVertexAttribArray(colorHandle);
    GLES20.glEnableVertexAttribArray(positionHandle);
    GLES20.glDrawElements(
            GLES20.GL_TRIANGLES, indexes.length,
            GLES20.GL_UNSIGNED_SHORT, indexBuffer);

    GLES20.glDisableVertexAttribArray(positionHandle);
    GLES20.glDisableVertexAttribArray(colorHandle);
}
 
開發者ID:PacktPublishing,項目名稱:Building-Android-UIs-with-Custom-Views,代碼行數:22,代碼來源:Object3D.java

示例5: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
public void draw() {
    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glUseProgram(mProgram);

    int mPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    int vertexStride = COORDS_PER_VERTEX * 4;
    GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, mVertexBuffer);

    GLES20.glUniform4fv(GLES20.glGetUniformLocation(mProgram, "aColor"), 1, mColor, 0);
    GLES20.glUniform2f(GLES20.glGetUniformLocation(mProgram, "aCirclePosition"), mCenterX, mCenterY);
    GLES20.glUniform1f(GLES20.glGetUniformLocation(mProgram, "aRadius"), mRadius);
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, mDrawOrder.length, GLES20.GL_UNSIGNED_SHORT, mDrawListBuffer);
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
開發者ID:beetsolutions,項目名稱:opengl_circle,代碼行數:17,代碼來源:GLCircleSprite.java

示例6: onDrawFrame

import android.opengl.GLES20; //導入方法依賴的package包/類
public int onDrawFrame(final int textureId) {
	GLES20.glUseProgram(mGLProgId);
	runPendingOnDrawTasks();
	if (!mIsInitialized) 
		return OpenGLUtils.NOT_INIT;
	
	mGLCubeBuffer.position(0);
	GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, mGLCubeBuffer);
	GLES20.glEnableVertexAttribArray(mGLAttribPosition);
	mGLTextureBuffer.position(0);
	GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,
	     mGLTextureBuffer);
	GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);
	if (textureId != OpenGLUtils.NO_TEXTURE) {
	 GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
	 GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
	 GLES20.glUniform1i(mGLUniformTexture, 0);
	}
	onDrawArraysPre();
	GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
	GLES20.glDisableVertexAttribArray(mGLAttribPosition);
	GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
	onDrawArraysAfter();
	GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
	return OpenGLUtils.ON_DRAWN;
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:27,代碼來源:GPUImageFilter.java

示例7: onDrawFrame

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public int onDrawFrame(int textureId) {
       GLES20.glUseProgram(mGLProgId);
       if(!isInitialized()) {
           return OpenGLUtils.NOT_INIT;
       }
       mGLCubeBuffer.position(0);
       GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, mGLCubeBuffer);
       GLES20.glEnableVertexAttribArray(mGLAttribPosition);
       mGLTextureBuffer.position(0);
       GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, mGLTextureBuffer);
       GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);
       GLES20.glUniformMatrix4fv(mTextureTransformMatrixLocation, 1, false, mTextureTransformMatrix, 0);
       
       if(textureId != OpenGLUtils.NO_TEXTURE){
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);
        GLES20.glUniform1i(mGLUniformTexture, 0);
       }
       
       GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
       GLES20.glDisableVertexAttribArray(mGLAttribPosition);
       GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
       GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
       return OpenGLUtils.ON_DRAWN;
   }
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:27,代碼來源:MagicVideoInputFilter.java

示例8: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
     * Encapsulates the OpenGL ES instructions for drawing this shape.
     *
     * @param mvpMatrix - The Model View Project matrix in which to draw
     *                  this shape.
     */
    public void draw(float[] mvpMatrix) {
        // Add program to OpenGL environment
        GLES20.glUseProgram(mProgram);

        // get handle to vertex shader's vPosition member
        mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

        // Enable a handle to the triangle vertices
        GLES20.glEnableVertexAttribArray(mPositionHandle);

        // Prepare the triangle coordinate data
        GLES20.glVertexAttribPointer(
                mPositionHandle, COORDS_PER_VERTEX,
                GLES20.GL_FLOAT, false,
                vertexStride, vertexBuffer);

        // get handle to fragment shader's vColor member
        mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");
        // Set color for drawing the triangle
        GLES20.glUniform4fv(mColorHandle, 1, color, 0);

        // get handle to shape's transformation matrix
        mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
//        MyGLRenderer.checkGlError("glGetUniformLocation");

        // Apply the projection and view transformation
        GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
//        MyGLRenderer.checkGlError("glUniformMatrix4fv");

        // Draw the square
        GLES20.glDrawElements(
                GLES20.GL_TRIANGLES, drawOrder.length,
                GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

        // Disable vertex array
        GLES20.glDisableVertexAttribArray(mPositionHandle);
    }
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:44,代碼來源:Square.java

示例9: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void draw(int textureId, FloatBuffer cubeBuffer, FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mProgram);

    if (mMaskGrey1TextureId == -1) {
        ondraw();//
    }

    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mAPositionHandle, 2, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mAPositionHandle);

    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mATextureCoordinateHandle, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);
    GLES20.glEnableVertexAttribArray(mATextureCoordinateHandle);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
    GLES20.glUniform1i(mUTextureHandle, 0);

    GLES20.glUniformMatrix4fv(mUMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    onDrawArraysPre();//

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

    onDrawArraysAfter();//

    GLES20.glDisableVertexAttribArray(mAPositionHandle);
    GLES20.glDisableVertexAttribArray(mATextureCoordinateHandle);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:33,代碼來源:SunriseFilter.java

示例10: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
private void draw(ShaderParameter[] params, int type, int count, float x, float y, float width,
                  float height) {
    setMatrix(params, x, y, width, height);
    int positionHandle = params[INDEX_POSITION].handle;
    GLES20.glEnableVertexAttribArray(positionHandle);
    checkError();
    GLES20.glDrawArrays(type, 0, count);
    checkError();
    GLES20.glDisableVertexAttribArray(positionHandle);
    checkError();
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:12,代碼來源:GLES20Canvas.java

示例11: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
public void draw(final int textureId1, final int textureId2,final FloatBuffer cubeBuffer,
                   final FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mGLProgId);
    runPendingOnDrawTasks();
    if (!mIsInitialized) {
        return;
    }
    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribPosition, 3, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribPosition);
    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,
            textureBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);
    if (textureId1 != OpenGlUtils.NO_TEXTURE) {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(mTextureTarget, textureId1);
        GLES20.glUniform1i(mGLUniformTexture1, 0);
    }
    if (textureId2 != OpenGlUtils.NO_TEXTURE) {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
        GLES20.glBindTexture(mTextureTarget, textureId2);
        GLES20.glUniform1i(mGLUniformTexture2, 1);
    }
    onDrawArraysPre();
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 6);
    GLES20.glDisableVertexAttribArray(mGLAttribPosition);
    GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
    GLES20.glBindTexture(mTextureTarget, 0);
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:31,代碼來源:GPUImageFilter.java

示例12: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * draw specific texture with specific texture matrix
 *
 * @param textureId texture ID
 * @param texMatrix texture matrix if this is null, the last one use(we don't check size of this array and needs at least 16 of float)
 */
public void draw(final int textureId, final float[] mvpMatrix, final float[] texMatrix) {
    // Select the program.
    GLES20.glUseProgram(hProgram);

    // Set the texture.
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(mTextureTarget, textureId);


    // Copy the texture transformation matrix over.
    GLES20.glUniformMatrix4fv(muTexMatrixLoc, 1, false, texMatrix, 0);

    // Copy the model / view / projection matrix over.
    GLES20.glUniformMatrix4fv(muMVPMatrixLoc, 1, false, mvpMatrix, 0);

    // Enable the "aPosition" vertex attribute.
    GLES20.glEnableVertexAttribArray(maPositionLoc);

    // Connect vertexBuffer to "aPosition".
    GLES20.glVertexAttribPointer(maPositionLoc, mCoordsPerVertex,
            GLES20.GL_FLOAT, false, mVertexStride, FULL_RECTANGLE_BUF);

    // Enable the "aTextureCoord" vertex attribute.
    GLES20.glEnableVertexAttribArray(maTextureCoordLoc);

    // Connect texBuffer to "aTextureCoord".
    GLES20.glVertexAttribPointer(maTextureCoordLoc, mCoordsPerVertex,
            GLES20.GL_FLOAT, false, mTexCoordStride, FULL_RECTANGLE_TEX_BUF);

    // Draw the rect.
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, mVertexCount);

    // Done -- disable vertex array, texture, and program.
    GLES20.glDisableVertexAttribArray(maPositionLoc);
    GLES20.glDisableVertexAttribArray(maTextureCoordLoc);
    GLES20.glBindTexture(mTextureTarget, 0);
}
 
開發者ID:LeonHover,項目名稱:MediaCodecRecorder,代碼行數:44,代碼來源:GLSurfaceFilter.java

示例13: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Encapsulates the OpenGL ES instructions for drawing this shape.
 *
 * @param mvpMatrix - The Model View Project matrix in which to draw
 * this shape.
 */
public void draw(float[] mvpMatrix) {
    // Add program to OpenGL environment
    GLES20.glUseProgram(mProgram);

    // get handle to vertex shader's vPosition member
    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

    // Enable a handle to the triangle vertices
    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Prepare the triangle coordinate data
    GLES20.glVertexAttribPointer(
            mPositionHandle, COORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false,
            vertexStride, vertexBuffer);

    // get handle to fragment shader's vColor member
    mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");

    // Set color for drawing the triangle
    GLES20.glUniform4fv(mColorHandle, 1, color, 0);

    // get handle to shape's transformation matrix
    mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
    MyGLRenderer.checkGlError("glGetUniformLocation");

    // Apply the projection and view transformation
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
    MyGLRenderer.checkGlError("glUniformMatrix4fv");

    // Draw the triangle
    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:43,代碼來源:Triangle.java

示例14: render

import android.opengl.GLES20; //導入方法依賴的package包/類
public void render(float[] mvpMatrix, int numIndices, int ibo, int positionVbo, int colorsVbo) {
  GLES20.glUseProgram(program);

  // Set up to feed positions to shader from positions VBO.
  GLES20.glEnableVertexAttribArray(positionHandle);
  GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, positionVbo);
  GLES20.glVertexAttribPointer(positionHandle, MyGLUtils.COORDS_PER_VERTEX, GLES20.GL_FLOAT, false,
      /* stride */ 0, /* offset in positionVbo */ 0);

  // Set up to feed colors to shader from color VBO.
  GLES20.glEnableVertexAttribArray(colorHandle);
  GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, colorsVbo);
  GLES20.glVertexAttribPointer(colorHandle, MyGLUtils.NUM_COLOR_COMPONENTS, GLES20.GL_FLOAT, false,
      /* stride */ 0, /* offset in colorVbo */ 0);

  // Feed MVP matrix uniform to shader.
  GLES20.glUniformMatrix4fv(mvpMatrixHandle, 1, false, mvpMatrix, 0);

  // Bind IBO and render the triangles.
  GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, ibo);
  GLES20.glDrawElements(GLES20.GL_TRIANGLES, numIndices, GLES20.GL_UNSIGNED_SHORT,
      /* offset in ibo */ 0);
  MyGLUtils.checkGlError("render");

  // Clean up.
  GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
  GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
  GLES20.glDisableVertexAttribArray(positionHandle);
  GLES20.glDisableVertexAttribArray(colorHandle);
  GLES20.glUseProgram(0);
}
 
開發者ID:googlevr,項目名稱:poly-sample-android,代碼行數:32,代碼來源:MyShader.java

示例15: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Renders the point cloud.
 *
 * @param pose              the current point cloud pose, from {@link Frame#getPointCloudPose()}.
 * @param cameraView        the camera view matrix for this frame, typically from
 *                          {@link Frame#getViewMatrix(float[], int)}.
 * @param cameraPerspective the camera projection matrix for this frame, typically from
 *                          {@link Session#getProjectionMatrix(float[], int, float, float)}.
 */
public void draw(Pose pose, float[] cameraView, float[] cameraPerspective) {
    float[] modelMatrix = new float[16];
    pose.toMatrix(modelMatrix, 0);

    float[] modelView = new float[16];
    float[] modelViewProjection = new float[16];
    Matrix.multiplyMM(modelView, 0, cameraView, 0, modelMatrix, 0);
    Matrix.multiplyMM(modelViewProjection, 0, cameraPerspective, 0, modelView, 0);

    ShaderUtil.checkGLError(TAG, "Before draw");

    GLES20.glUseProgram(mProgramName);
    GLES20.glEnableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);
    GLES20.glVertexAttribPointer(
            mPositionAttribute, 4, GLES20.GL_FLOAT, false, BYTES_PER_POINT, 0);
    GLES20.glUniform4f(mColorUniform, 31.0f / 255.0f, 188.0f / 255.0f, 210.0f / 255.0f, 1.0f);
    GLES20.glUniformMatrix4fv(mModelViewProjectionUniform, 1, false, modelViewProjection, 0);
    GLES20.glUniform1f(mPointSizeUniform, 5.0f);

    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, mNumPoints);
    GLES20.glDisableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

    ShaderUtil.checkGLError(TAG, "Draw");
}
 
開發者ID:nimbl3,項目名稱:nimbl3-arcore,代碼行數:36,代碼來源:PointCloudRenderer.java


注:本文中的android.opengl.GLES20.glDisableVertexAttribArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。