Code example for GL10

Methods: glColor4fglDrawArraysglEnableglNormal3fglTexCoordPointerglVertexPointer

0
      mTextureBuffer.put(texCoords);
      mTextureBuffer.position(0);
   } 
 
   public void draw(GL10 gl) {
      gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer);
      gl.glEnable(GL10.GL_TEXTURE_2D); // workaround bug 3623
      gl.glTexCoordPointer(2, GL10.GL_FIXED, 0, mTextureBuffer);
 
      gl.glColor4f(1, 1, 1, 1);
      gl.glNormal3f(0, 0, 1);
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
      gl.glNormal3f(0, 0, -1);
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4);
 
      gl.glColor4f(1, 1, 1, 1);
      gl.glNormal3f(-1, 0, 0);
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 8, 4);
      gl.glNormal3f(1, 0, 0);
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 12, 4);
 
      gl.glColor4f(1, 1, 1, 1);
      gl.glNormal3f(0, 1, 0);
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 16, 4);
      gl.glNormal3f(0, -1, 0);
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 20, 4);
   } 
   static void loadTexture(GL10 gl, Context context, int resource) {
      Bitmap bmp = BitmapFactory.decodeResource(
            context.getResources(), resource);
      GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);
Stop searching for code, let great code find you!  Add Codota to your java IDE