本文整理汇总了Java中android.opengl.GLES10.glDrawArrays方法的典型用法代码示例。如果您正苦于以下问题:Java GLES10.glDrawArrays方法的具体用法?Java GLES10.glDrawArrays怎么用?Java GLES10.glDrawArrays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.GLES10
的用法示例。
在下文中一共展示了GLES10.glDrawArrays方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import android.opengl.GLES10; //导入方法依赖的package包/类
@Override
public void draw(final int texId, final float[] tex_matrix, final int offset) {
// FIXME Matrixを適用
GLES10.glEnableClientState(GLES10.GL_VERTEX_ARRAY);
pVertex.position(0);
GLES10.glVertexPointer(2, GLES10.GL_FLOAT, VERTEX_SZ, pVertex);
//--------------------------------------------------------------------------------
GLES10.glEnableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
pTexCoord.position(0);
GLES10.glTexCoordPointer(VERTEX_NUM, GLES10.GL_FLOAT, VERTEX_SZ, pTexCoord);
GLES10.glActiveTexture(GLES10.GL_TEXTURE0);
GLES10.glBindTexture(mTexTarget, texId);
//--------------------------------------------------------------------------------
GLES10.glDrawArrays(GLES10.GL_TRIANGLE_STRIP, 0, VERTEX_NUM);
//--------------------------------------------------------------------------------
GLES10.glBindTexture(mTexTarget, 0);
GLES10.glDisableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
//--------------------------------------------------------------------------------
GLES10.glDisableClientState(GLES10.GL_VERTEX_ARRAY);
}
示例2: drawTrianglesWithTextureColored
import android.opengl.GLES10; //导入方法依赖的package包/类
@Override
public void drawTrianglesWithTextureColored(TextureHandle textureid, float[] geometry) {
glBindTexture(textureid);
GLES10.glEnableClientState(GLES10.GL_COLOR_ARRAY);
FloatBuffer buffer = generateTemporaryFloatBuffer(geometry);
GLES10.glVertexPointer(3, GLES10.GL_FLOAT, 9 * 4, buffer);
FloatBuffer texbuffer = reuseableBufferDuplicate;
texbuffer.position(3);
GLES10.glTexCoordPointer(2, GLES10.GL_FLOAT, 9 * 4, texbuffer);
FloatBuffer colorbuffer = buffer.duplicate(); // we need it selden enogh
// to allocate a new one.
colorbuffer.position(5);
GLES10.glColorPointer(4, GLES10.GL_FLOAT, 9 * 4, colorbuffer);
GLES10.glDrawArrays(GLES10.GL_TRIANGLES, 0, geometry.length / 9);
GLES10.glDisableClientState(GLES10.GL_COLOR_ARRAY);
}
示例3: fillQuad
import android.opengl.GLES10; //导入方法依赖的package包/类
@Override
public void fillQuad(float x1, float y1, float x2, float y2) {
quadDatas = new float[3 * 6];
quadDatas[0] = x1;
quadDatas[1] = y1;
quadDatas[2] = 0;
quadDatas[3] = x2;
quadDatas[4] = y1;
quadDatas[5] = 0;
quadDatas[6] = x1;
quadDatas[7] = y2;
quadDatas[8] = 0;
quadDatas[9] = x1;
quadDatas[10] = y2;
quadDatas[11] = 0;
quadDatas[12] = x2;
quadDatas[13] = y1;
quadDatas[14] = 0;
quadDatas[15] = x2;
quadDatas[16] = y2;
quadDatas[17] = 0;
glBindTexture(null);
FloatBuffer floatBuff = generateTemporaryFloatBuffer(quadDatas);
GLES10.glDisableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
GLES10.glVertexPointer(3, GLES10.GL_FLOAT, 3 * 4, floatBuff);
GLES10.glDrawArrays(GLES10.GL_TRIANGLES, 0, quadDatas.length / 3);
GLES10.glEnableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
}
示例4: drawLine
import android.opengl.GLES10; //导入方法依赖的package包/类
@Override
public void drawLine(float[] points, boolean loop) {
if (points.length % 3 != 0) {
throw new IllegalArgumentException(
"Point array length needs to be multiple of 3.");
}
glBindTexture(null);
FloatBuffer floatBuff = generateTemporaryFloatBuffer(points);
GLES10.glDisableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
GLES10.glVertexPointer(3, GLES10.GL_FLOAT, 0, floatBuff);
GLES10.glDrawArrays(loop ? GLES10.GL_LINE_LOOP : GLES10.GL_LINE_STRIP,
0, points.length / 3);
GLES10.glEnableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
}
示例5: drawTrianglesWithTexture
import android.opengl.GLES10; //导入方法依赖的package包/类
@Override
public void drawTrianglesWithTexture(TextureHandle textureid, float[] geometry) {
glBindTexture(textureid);
FloatBuffer buffer = generateTemporaryFloatBuffer(geometry);
GLES10.glVertexPointer(3, GLES10.GL_FLOAT, 5 * 4, buffer);
FloatBuffer texbuffer = reuseableBufferDuplicate;
texbuffer.position(3);
GLES10.glTexCoordPointer(2, GLES10.GL_FLOAT, 5 * 4, texbuffer);
GLES10.glDrawArrays(GLES10.GL_TRIANGLES, 0, geometry.length / 5);
}