本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glEnableClientState方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glEnableClientState方法的具体用法?Java GL10.glEnableClientState怎么用?Java GL10.glEnableClientState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.khronos.opengles.GL10
的用法示例。
在下文中一共展示了GL10.glEnableClientState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void render(GL10 gl) {
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
if (colorIndex>4) {
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
}
else {
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
}
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer);
if (colorIndex>4) {
gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer);
}
else if (colorIndex==4) {
// single color
gl.glColor4f(
colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]);
}
gl.glDrawArrays(glMode, 0, numVertices);
}
示例2: onDrawFrame
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
gl.glClearColor(1.f, 0.f, 0.f, 1.f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.f, 0.f, -50.f);
long time = SystemClock.uptimeMillis() % 4000L;
float angle = 0.090f * ((int) time);
gl.glRotatef(angle, 0.f, 0.f, 1.f);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glColor4f(1.f, 1.f, 1.f, 1.f);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例3: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void draw(GL10 gl) {
if (normalList == null || triangleBuffer == null) {
return;
}
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
//gl.glFrontFace(GL10.GL_CCW);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, triangleBuffer);
gl.glNormalPointer(GL10.GL_FLOAT,0, normalBuffer);
gl.glDrawArrays(GL10.GL_TRIANGLES, 0, vertext_size*3);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
}
示例4: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* Encapsulates the OpenGL ES instructions for drawing this shape.
*
* @param gl - The OpenGL ES context in which to draw this shape.
*/
public void draw(GL10 gl) {
// Since this shape uses vertex arrays, enable them
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
// draw the shape
gl.glColor4f( // set color
color[0], color[1],
color[2], color[3]);
gl.glVertexPointer( // point to vertex data:
COORDS_PER_VERTEX,
GL10.GL_FLOAT, 0, vertexBuffer);
gl.glDrawElements( // draw shape:
GL10.GL_TRIANGLES,
drawOrder.length, GL10.GL_UNSIGNED_SHORT,
drawListBuffer);
// Disable vertex array drawing to avoid
// conflicts with shapes that don't use it
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例5: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* Encapsulates the OpenGL ES instructions for drawing this shape.
*
* @param gl - The OpenGL ES context in which to draw this shape.
*/
public void draw(GL10 gl) {
// Since this shape uses vertex arrays, enable them
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
// draw the shape
gl.glColor4f( // set color:
color[0], color[1],
color[2], color[3]);
gl.glVertexPointer( // point to vertex data:
COORDS_PER_VERTEX,
GL10.GL_FLOAT, 0, vertexBuffer);
gl.glDrawArrays( // draw shape:
GL10.GL_TRIANGLES, 0,
triangleCoords.length / COORDS_PER_VERTEX);
// Disable vertex array drawing to avoid
// conflicts with shapes that don't use it
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例6: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl){
gl.glRotatef(45f,0,0,0);
gl.glFrontFace(GL10.GL_CCW);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glCullFace(GL10.GL_BACK);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
// gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
gl.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
// gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
gl.glDisable(GL10.GL_CULL_FACE);
}
示例7: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl){
gl.glRotatef(45f,0,0,0);
GLES20.glFrontFace(GL10.GL_CCW);
GLES20.glEnable(GL10.GL_CULL_FACE);
GLES20.glCullFace(GL10.GL_BACK);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
// gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
GLES20.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
// gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
GLES20.glDisable(GL10.GL_CULL_FACE);
}
示例8: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl) {
gl.glClearColor(1.0f,1.0f,1.0f,1.0f);
if(shouldLoadTexture){
loadTexture(gl);
shouldLoadTexture = false;
}
if(mTextureId != -1 && mVertexBuffer != null){
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,mVertexBuffer);
gl.glBindTexture(GL10.GL_TEXTURE_2D,mTextureId);
}
// gl.glRotatef(180.0f,1,0,0);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(2,GL10.GL_FLOAT,0,mVertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
// gl.glDrawArrays(GL10.GL_TRIANGLES,0,4);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
if(mTextureId != -1 && mVertexBuffer != null){
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glDisable(GL10.GL_TEXTURE_2D);
}
}
示例9: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl){
gl.glRotatef(30f, 1, 0, 0);
gl.glRotatef(30f, 0, 1, 0);
// gl.glRotatef(45f, 0, 0, 1);
gl.glFrontFace(GL10.GL_CCW);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glCullFace(GL10.GL_BACK);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
// gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
gl.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
// gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
gl.glDisable(GL10.GL_CULL_FACE);
}
示例10: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void draw(GL10 gl, float alpha) {
gl.glDisable(GL_TEXTURE_2D);
gl.glEnable(GL_BLEND);
gl.glEnableClientState(GL_VERTEX_ARRAY);
gl.glDisableClientState(GL_COLOR_ARRAY);
// Use mColorBuffer as a global alpha mask:
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL11.GL_COMBINE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_REPLACE);
glTexEnvx(GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_MODULATE); // mix with alpha from glColor
// Alpha from glColor will be used thanks to GL_MODULATE mode
glColor4f(1f, 1f, 1f, 1f-alpha);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, VERTS, GL_UNSIGNED_SHORT, mIndexBuffer);
}
示例11: drawLine
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void drawLine(GL10 gl, Position3D p3PrevPoint, Position3D p3NextPoint, com.cyzapps.VisualMFP.Color color) {
// set the colour for the line
gl.glColor4f(color.getF1R(), color.getF1G(), color.getF1B(), color.getF1Alpha());
float vertices[] = {
(float)p3PrevPoint.getX(), (float)p3PrevPoint.getY(), (float)p3PrevPoint.getZ(),
(float)p3NextPoint.getX(), (float)p3NextPoint.getY(), (float)p3NextPoint.getZ(),
};
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
byteBuffer.order(ByteOrder.nativeOrder());
FloatBuffer vertexBuffer;
vertexBuffer = byteBuffer.asFloatBuffer();
vertexBuffer.put(vertices);
// set the cursor position to the beginning of the buffer
vertexBuffer.position(0);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
// Set the face rotation
//gl.glFrontFace(GL10.GL_CW);
// Point to our vertex buffer
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
// Draw the vertices as triangle strip
gl.glDrawArrays(GL10.GL_LINES, 0, vertices.length / 3);
// Disable the client state before leaving
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例12: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl) {
// gl.glColor4f(1.0f,0.0f,0.0f,1.0f);
// gl.glPointSize(8.0f);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
gl.glVertexPointer(3, GL10.GL_VERTEX_ARRAY,0,mVertexBuffer);
gl.glColorPointer(4, GL10.GL_FIXED,0,mColorBuffer);
gl.glDrawArrays(GL10.GL_POINTS,0,3);
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例13: drawTranslatedCube
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* Draws a translated cube
*
* @param gl the surface
* @param translateX x-translation
* @param translateY y-translation
* @param translateZ z-translation
*/
private void drawTranslatedCube(GL10 gl, float translateX, float translateY, float translateZ) {
gl.glPushMatrix();
gl.glTranslatef(translateX, translateY, translateZ);
// draw our object
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
mCube.draw(gl);
gl.glPopMatrix();
}
示例14: drawRectangle
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void drawRectangle(GL10 gl, Position3D p3LeftTop, Position3D p3RightBottom, com.cyzapps.VisualMFP.Color color) {
/** 3d chart ignore point shape and size. An alternative way is like
gl.glColor3f(r, g, b);
gl.glBegin(GL.GL_QUADS);
gl.glVertex3f(-halfFaceSize, -halfFaceSize, halfFaceSize);
gl.glVertex3f( halfFaceSize, -halfFaceSize, halfFaceSize);
gl.glVertex3f( halfFaceSize, halfFaceSize, halfFaceSize);
gl.glVertex3f(-halfFaceSize, halfFaceSize, halfFaceSize);
gl.glEnd();
*/
gl.glColor4f(color.getF1R(), color.getF1G(), color.getF1B(), color.getF1Alpha());
float vertices[] = {
(float)p3LeftTop.getX(), (float)p3RightBottom.getY(), (float)p3LeftTop.getZ(),
(float)p3RightBottom.getX(), (float)p3RightBottom.getY(), (float)p3RightBottom.getZ(),
(float)p3LeftTop.getX(), (float)p3LeftTop.getY(), (float)p3LeftTop.getZ(),
(float)p3RightBottom.getX(), (float)p3LeftTop.getY(), (float)p3LeftTop.getZ()
};
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
byteBuffer.order(ByteOrder.nativeOrder());
FloatBuffer vertexBuffer;
vertexBuffer = byteBuffer.asFloatBuffer();
vertexBuffer.put(vertices);
// set the cursor position to the beginning of the buffer
vertexBuffer.position(0);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
// Set the face rotation
//gl.glFrontFace(GL10.GL_CW);
// Point to our vertex buffer
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
// Draw the vertices as triangle strip
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);
// Disable the client state before leaving
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
示例15: draw
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
* same as draw in a Sprite but doesn't render a texture
* @param gl
*/
@Override
public void draw(GL10 gl) {
textureCoordinates = Alignment.getVertices(this, Alignment.LEFT_TOP);
ByteBuffer byteBuf = ByteBuffer.allocateDirect(textureCoordinates.length * 4);
byteBuf.order(ByteOrder.nativeOrder());
mTextureBuffer = byteBuf.asFloatBuffer();
mTextureBuffer.put(textureCoordinates);
mTextureBuffer.position(0);
float vertices[] = Alignment.getVertices(this, Alignment.LEFT_TOP);
ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4);
vbb.order(ByteOrder.nativeOrder());
vertexBuffer = vbb.asFloatBuffer();
vertexBuffer.put(vertices);
vertexBuffer.position(0);
ByteBuffer ibb = ByteBuffer.allocateDirect(indices.length * 2);
ibb.order(ByteOrder.nativeOrder());
indexBuffer = ibb.asShortBuffer();
indexBuffer.put(indices);
indexBuffer.position(0);
gl.glEnable(GL_BLEND);
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4f(red / 100, green / 100, blue / 100, alpha / 100);
gl.glFrontFace(GL10.GL_CCW);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glCullFace(GL10.GL_BACK);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTextureBuffer);
gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glDisable(GL10.GL_CULL_FACE);
}