本文整理汇总了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");
}
示例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");
}
示例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;
}
示例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;
}
示例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");
}