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


Java GLES20.glBufferSubData方法代碼示例

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


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

示例1: update

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Updates the OpenGL buffer contents to the provided point.  Repeated calls with the same
 * point cloud will be ignored.
 */
public void update(PointCloud cloud) {
    if (mLastPointCloud == cloud) {
        // Redundant call.
        return;
    }

    ShaderUtil.checkGLError(TAG, "before update");

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);
    mLastPointCloud = cloud;

    // If the VBO is not large enough to fit the new point cloud, resize it.
    mNumPoints = mLastPointCloud.getPoints().remaining() / FLOATS_PER_POINT;
    if (mNumPoints * BYTES_PER_POINT > mVboSize) {
        while (mNumPoints * BYTES_PER_POINT > mVboSize) {
            mVboSize *= 2;
        }
        GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, mVboSize, null, GLES20.GL_DYNAMIC_DRAW);
    }
    GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, 0, mNumPoints * BYTES_PER_POINT,
        mLastPointCloud.getPoints());
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

    ShaderUtil.checkGLError(TAG, "after update");
}
 
開發者ID:googlevr,項目名稱:poly-sample-android,代碼行數:30,代碼來源:PointCloudRenderer.java

示例2: update

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Updates the OpenGL buffer contents to the provided point.  Repeated calls with the same
 * point cloud will be ignored.
 */
public void update(PointCloud cloud) {
    if (mLastPointCloud == cloud) {
        // Redundant call.
        return;
    }

    ShaderUtil.checkGLError(TAG, "before update");

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);
    mLastPointCloud = cloud;

    // If the VBO is not large enough to fit the new point cloud, resize it.
    mNumPoints = mLastPointCloud.getPoints().remaining() / FLOATS_PER_POINT;
    if (mNumPoints * BYTES_PER_POINT > mVboSize) {
        while (mNumPoints * BYTES_PER_POINT > mVboSize) {
            mVboSize *= 2;
        }
        GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, mVboSize, null, GLES20.GL_DYNAMIC_DRAW);
    }
    GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, 0, mNumPoints * BYTES_PER_POINT,
            mLastPointCloud.getPoints());
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

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

示例3: updateGLData

import android.opengl.GLES20; //導入方法依賴的package包/類
public void updateGLData() {
	if (updateStart == -1) return;

	vertices.position(updateStart);
	bind();

	if (updateStart == 0 && updateEnd == vertices.limit()) {
		GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, vertices.limit() * 4, vertices, GLES20.GL_DYNAMIC_DRAW);
	} else {
		GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, updateStart * 4, (updateEnd - updateStart) * 4, vertices);
	}

	release();
	updateStart = updateEnd = -1;
}
 
開發者ID:G2159687,項目名稱:ESPD,代碼行數:16,代碼來源:Vertexbuffer.java

示例4: updateGLData

import android.opengl.GLES20; //導入方法依賴的package包/類
public void updateGLData(){
	if (updateStart == -1) return;

	vertices.position(updateStart);
	bind();

	if (updateStart == 0 && updateEnd == vertices.limit()){
		GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, vertices.limit()*4, vertices, GLES20.GL_DYNAMIC_DRAW);
	} else {
		GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, updateStart*4, (updateEnd - updateStart)*4, vertices);
	}

	release();
	updateStart = updateEnd = -1;
}
 
開發者ID:mango-tree,項目名稱:UNIST-pixel-dungeon,代碼行數:16,代碼來源:Vertexbuffer.java

示例5: upload

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
     * This takes the float[] and creates FloatBuffers, Binds the VBO, and upload the Attributes to
     * correct locations with the correct offsets so the Vertex and Fragment shader can render the lines
     */
    public void upload() {
        bNeedsUpdate.set(false);

        FloatBuffer current = toFloatBuffer(mPositions);
        FloatBuffer next = toFloatBuffer(mNext);
        FloatBuffer previous = toFloatBuffer(mPrevious);

        FloatBuffer side = toFloatBuffer(mSide);
        FloatBuffer width = toFloatBuffer(mWidth);
        FloatBuffer counter = toFloatBuffer(mCounters);


//        mNumPoints = mPositions.length;

        mPositionAddress = 0;
        mNextAddress = mPositionAddress + mNumBytes * 3 * BYTES_PER_FLOAT;
        mPreviousAddress = mNextAddress + mNumBytes * 3 * BYTES_PER_FLOAT;
        mSideAddress = mPreviousAddress + mNumBytes *3 * BYTES_PER_FLOAT;

        mWidthAddress = mSideAddress + mNumBytes * BYTES_PER_FLOAT;
        mCounterAddress = mWidthAddress + mNumBytes * BYTES_PER_FLOAT;
        mVboSize = mCounterAddress + mNumBytes * BYTES_PER_FLOAT;

        ShaderUtil.checkGLError(TAG, "before update");

        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);

        GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, mVboSize, null, GLES20.GL_DYNAMIC_DRAW);

        GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, mPositionAddress, mNumBytes * 3 * BYTES_PER_FLOAT,
                current);
        GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, mNextAddress, mNumBytes * 3 * BYTES_PER_FLOAT,
                next);
        GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, mPreviousAddress, mNumBytes * 3 * BYTES_PER_FLOAT,
                previous);
        GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, mSideAddress, mNumBytes * BYTES_PER_FLOAT,
                side);
        GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, mWidthAddress, mNumBytes * BYTES_PER_FLOAT,
                width);
        GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, mCounterAddress, mNumBytes * BYTES_PER_FLOAT,
                counter);


        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

        ShaderUtil.checkGLError(TAG, "after update");
    }
 
開發者ID:googlecreativelab,項目名稱:ar-drawing-java,代碼行數:52,代碼來源:LineShaderRenderer.java


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