本文整理匯總了Java中javax.microedition.khronos.opengles.GL10.glCullFace方法的典型用法代碼示例。如果您正苦於以下問題:Java GL10.glCullFace方法的具體用法?Java GL10.glCullFace怎麽用?Java GL10.glCullFace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.microedition.khronos.opengles.GL10
的用法示例。
在下文中一共展示了GL10.glCullFace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}