当前位置: 首页>>代码示例>>Java>>正文


Java GL10.glFrontFace方法代码示例

本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glFrontFace方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glFrontFace方法的具体用法?Java GL10.glFrontFace怎么用?Java GL10.glFrontFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.microedition.khronos.opengles.GL10的用法示例。


在下文中一共展示了GL10.glFrontFace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:19,代码来源:Square.java

示例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);
    }
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:21,代码来源:Cube.java

示例3: draw

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
 * Draws this cube of the given GL-Surface
 * 
 * @param gl The GL-Surface this cube should be drawn upon.
 */
public void draw(GL10 gl) {
    gl.glEnable(GL10.GL_CULL_FACE);
    gl.glFrontFace(GL10.GL_CW);
    gl.glShadeModel(GL10.GL_SMOOTH);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
    gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer);
    gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
}
 
开发者ID:peter10110,项目名称:Android-SteamVR-controller,代码行数:14,代码来源:Cube.java

示例4: 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);
}
 
开发者ID:ondramisar,项目名称:AdronEngine,代码行数:56,代码来源:HitBox.java

示例5: applyRectTexture

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
   * convert a rectangle bitmap texture and apply it to a rectangle,
   * note that order of pnts is top left -> top right -> bottom left -> bottom right
   */
  public void applyRectTexture(GL10 gl, Position3D[] pnts, int nTextureId) {    //a 4 point rectangle.

  	if (nTextureId < 0 || nTextureId >= NUMBER_OF_TEXTURES)	{
  		return;	// invalid texture
  	}
      // apply the texture
      FloatBuffer vertexBuffer;    // buffer holding the vertices
      float vertices[] = {
              (float)pnts[0].getX(), (float)pnts[0].getY(), (float)pnts[0].getZ(),    // bottom left
              (float)pnts[1].getX(), (float)pnts[1].getY(), (float)pnts[1].getZ(),    // top left
              (float)pnts[2].getX(), (float)pnts[2].getY(), (float)pnts[2].getZ(),    // bottom right
              (float)pnts[3].getX(), (float)pnts[3].getY(), (float)pnts[3].getZ(),    // top right
      };

      FloatBuffer textureBuffer;    // buffer holding the texture coordinates
      float texture[] = {           
              // Mapping coordinates for the vertices
              0.0f, 1.0f,        // top left
              0.0f, 0.0f,        // bottom left
              1.0f, 1.0f,        // top right
              1.0f, 0.0f        // bottom right
      };
      // a float has 4 bytes so we allocate for each coordinate 4 bytes
      ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
      byteBuffer.order(ByteOrder.nativeOrder());
     
      // allocates the memory from the byte buffer
      vertexBuffer = byteBuffer.asFloatBuffer();
     
      // fill the vertexBuffer with the vertices
      vertexBuffer.put(vertices);
     
      // set the cursor position to the beginning of the buffer
      vertexBuffer.position(0);
     
      byteBuffer = ByteBuffer.allocateDirect(texture.length * 4);
      byteBuffer.order(ByteOrder.nativeOrder());
      textureBuffer = byteBuffer.asFloatBuffer();
      textureBuffer.put(texture);
      textureBuffer.position(0);

// Set the face rotation
gl.glFrontFace(GL10.GL_CW);
     
      // Point to our buffers
      gl.glEnable(GL10.GL_TEXTURE_2D);            //Enable Texture Mapping ( NEW )
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
//gl.glBlendFunc(GL10.GL_ZERO, GL10.GL_ONE);
      gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
      gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
      gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);	// was GL10.GL_REPLACE
     
      //...and bind it to our array
      gl.glBindTexture(GL10.GL_TEXTURE_2D, mtextureMgr.mtextures[nTextureId]);
      
      gl.glColor4f(0f, 0f, 0f, 0f);
     
      // Point to our vertex buffer
      gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
      gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);
     
      // 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);
      gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
      gl.glDisable(GL10.GL_BLEND);
      gl.glDisable(GL10.GL_TEXTURE_2D);            //Disable Texture Mapping ( NEW )
  }
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:76,代码来源:OGLChart.java


注:本文中的javax.microedition.khronos.opengles.GL10.glFrontFace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。