本文整理汇总了Java中android.opengl.GLES11.glColorPointer方法的典型用法代码示例。如果您正苦于以下问题:Java GLES11.glColorPointer方法的具体用法?Java GLES11.glColorPointer怎么用?Java GLES11.glColorPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.GLES11
的用法示例。
在下文中一共展示了GLES11.glColorPointer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import android.opengl.GLES11; //导入方法依赖的package包/类
public void render() {
GLES11.glDepthFunc(GLES11.GL_LESS);
GLES11.glDepthMask(false);
GLES11.glEnable(GLES11.GL_BLEND);
GLES11.glDisable(GLES11.GL_CULL_FACE);
GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
GLES11.glEnableClientState(GLES11.GL_COLOR_ARRAY);
GLES11.glDisable(GLES11.GL_LIGHTING);
GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE);
MathHelper.copyMatrix(getMatrix(), saveMatrix);
for (int i = 0; i < 2; i++) {
GLES11.glPushMatrix();
GLES11.glMultMatrixf(getMatrix(), 0);
GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, diskBuffer);
GLES11.glColorPointer(4, GLES11.GL_FLOAT, 0, colorBuffer1);
GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, 10);
GLES11.glVertexPointer(3, GLES11.GL_FLOAT, 0, cylinderBuffer);
GLES11.glColorPointer(4, GLES11.GL_FLOAT, 0, colorBuffer2);
GLES11.glDrawArrays(GLES11.GL_TRIANGLE_STRIP, 0, 18);
GLES11.glPopMatrix();
scale(0.4f, 0.4f, 1.2f);
}
MathHelper.copyMatrix(saveMatrix, currentMatrix);
extractVectors();
GLES11.glEnable(GLES11.GL_CULL_FACE);
GLES11.glEnable(GLES11.GL_LIGHTING);
GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY);
GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY);
GLES11.glDepthFunc(GLES11.GL_LESS);
GLES11.glDepthMask(true);
GLES11.glDisable(GLES11.GL_BLEND);
}
示例2: bind
import android.opengl.GLES11; //导入方法依赖的package包/类
public void bind() {
GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY); // Enable Position
// in Vertices
vertices.position(0); // Set Vertex Buffer to Position
GLES11.glVertexPointer(positionCnt, GLES11.GL_FLOAT, vertexSize,
vertices); // Set Vertex Pointer
if (hasColor) { // IF Vertices Have Color
GLES11.glEnableClientState(GLES11.GL_COLOR_ARRAY); // Enable Color
// in Vertices
vertices.position(positionCnt); // Set Vertex Buffer to Color
GLES11.glColorPointer(COLOR_CNT, GLES11.GL_FLOAT, vertexSize,
vertices); // Set Color Pointer
}
if (hasTexCoords) { // IF Vertices Have Texture Coords
GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY); // Enable
// Texture
// Coords
// in
// Vertices
vertices.position(positionCnt + (hasColor ? COLOR_CNT : 0)); // Set
// Vertex
// Buffer
// to
// Texture
// Coords
// (NOTE:
// position
// based
// on
// whether
// color
// is
// also
// specified)
GLES11.glTexCoordPointer(TEXCOORD_CNT, GLES11.GL_FLOAT, vertexSize,
vertices); // Set Texture Coords Pointer
}
if (hasNormals) {
GLES11.glEnableClientState(GLES11.GL_NORMAL_ARRAY); // Enable
// Normals in
// Vertices
vertices.position(positionCnt + (hasColor ? COLOR_CNT : 0)
+ (hasTexCoords ? TEXCOORD_CNT : 0)); // Set Vertex Buffer
// to Normals (NOTE:
// position based on
// whether
// color/texcoords
// is also
// specified)
GLES11.glNormalPointer(GLES11.GL_FLOAT, vertexSize, vertices); // Set
// Normals
// Pointer
}
}
示例3: drawFull
import android.opengl.GLES11; //导入方法依赖的package包/类
public void drawFull(int primitiveType, int offset, int numVertices) {
GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY); // Enable Position
// in Vertices
vertices.position(0); // Set Vertex Buffer to Position
GLES11.glVertexPointer(positionCnt, GLES11.GL_FLOAT, vertexSize,
vertices); // Set Vertex Pointer
if (hasColor) { // IF Vertices Have Color
GLES11.glEnableClientState(GLES11.GL_COLOR_ARRAY); // Enable Color
// in Vertices
vertices.position(positionCnt); // Set Vertex Buffer to Color
GLES11.glColorPointer(COLOR_CNT, GLES11.GL_FLOAT, vertexSize,
vertices); // Set Color Pointer
}
if (hasTexCoords) { // IF Vertices Have Texture Coords
GLES11.glEnableClientState(GLES11.GL_TEXTURE_COORD_ARRAY); // Enable
// Texture
// Coords
// in
// Vertices
vertices.position(positionCnt + (hasColor ? COLOR_CNT : 0)); // Set
// Vertex
// Buffer
// to
// Texture
// Coords
// (NOTE:
// position
// based
// on
// whether
// color
// is
// also
// specified)
GLES11.glTexCoordPointer(TEXCOORD_CNT, GLES11.GL_FLOAT, vertexSize,
vertices); // Set Texture Coords Pointer
}
if (indices != null) { // IF Indices Exist
indices.position(offset); // Set Index Buffer to Specified Offset
GLES11.glDrawElements(primitiveType, numVertices,
GLES11.GL_UNSIGNED_SHORT, indices); // Draw Indexed
} else { // ELSE No Indices Exist
GLES11.glDrawArrays(primitiveType, offset, numVertices); // Draw
// Direct
// (Array)
}
if (hasTexCoords) // IF Vertices Have Texture Coords
GLES11.glDisableClientState(GLES11.GL_TEXTURE_COORD_ARRAY); // Clear
// Texture
// Coords
// State
if (hasColor) // IF Vertices Have Color
GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY); // Clear Color
// State
GLES11.glDisableClientState(GLES11.GL_VERTEX_ARRAY); // Clear Vertex
// Array State
}
示例4: gradientRect
import android.opengl.GLES11; //导入方法依赖的package包/类
@Override
public void gradientRect(int x, int y, int width, int height, boolean horizontal, boolean vertical, long color1, long color2) {
int x2 = transX(x + width - 1);
int ty2 = transY(y + height - 1);
x = transX(x);
y = transY(y);
int ty = y < 0 ? 0 : y;
if (ty2 < 0) {
return;
}
float alpha1 = (float) ((int) ((color1 & 0xFF000000l) >> 24)) / 255.0f;
float red1 = ((color1 & 0x00FF0000) >> 16) / 255.0f;
float green1 = ((color1 & 0x0000FF00) >> 8) / 255.0f;
float blue1 = (color1 & 0x000000FF) / 255.0f;
float alpha2 = (float) ((int) ((color2 & 0xFF000000l) >> 24)) / 255.0f;
float red2 = ((color2 & 0x00FF0000) >> 16) / 255.0f;
float green2 = ((color2 & 0x0000FF00) >> 8) / 255.0f;
float blue2 = (color2 & 0x000000FF) / 255.0f;
GLES11.glEnableClientState(GLES11.GL_VERTEX_ARRAY);
GLES11.glEnableClientState(GLES11.GL_COLOR_ARRAY);
rectBuffer.clear();
rectBuffer.put(x);
rectBuffer.put(ty);
rectBuffer.put(x2);
rectBuffer.put(ty);
rectBuffer.put(x2);
rectBuffer.put(ty2);
rectBuffer.put(x);
rectBuffer.put(ty2);
rectBuffer.position(0);
colorBuffer.clear();
colorBuffer.put(red1); colorBuffer.put(green1); colorBuffer.put(blue1); colorBuffer.put(alpha1);
colorBuffer.put(horizontal ? red2 : red1); colorBuffer.put(horizontal ? green2 : green1); colorBuffer.put(horizontal ? blue2 : blue1); colorBuffer.put(horizontal ? alpha2 : alpha1);
colorBuffer.put(red2); colorBuffer.put(green2); colorBuffer.put(blue2); colorBuffer.put(alpha2);
colorBuffer.put(vertical ? red2 : red1); colorBuffer.put(vertical ? green2 : green1); colorBuffer.put(vertical ? blue2 : blue1); colorBuffer.put(vertical ? alpha2 : alpha1);
colorBuffer.position(0);
GLES11.glColorPointer(4, GLES11.GL_FLOAT, 0, colorBuffer);
GLES11.glVertexPointer(2, GLES11.GL_FLOAT, 0, rectBuffer);
GLES11.glDrawArrays(GLES11.GL_TRIANGLE_FAN, 0, 4);
GLES11.glDisableClientState(GLES11.GL_COLOR_ARRAY);
}