当前位置: 首页>>代码示例>>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;未经允许,请勿转载。