本文整理汇总了Java中javax.microedition.khronos.opengles.GL11Ext.glLoadPaletteFromModelViewMatrixOES方法的典型用法代码示例。如果您正苦于以下问题:Java GL11Ext.glLoadPaletteFromModelViewMatrixOES方法的具体用法?Java GL11Ext.glLoadPaletteFromModelViewMatrixOES怎么用?Java GL11Ext.glLoadPaletteFromModelViewMatrixOES使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.khronos.opengles.GL11Ext
的用法示例。
在下文中一共展示了GL11Ext.glLoadPaletteFromModelViewMatrixOES方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDrawFrame
import javax.microedition.khronos.opengles.GL11Ext; //导入方法依赖的package包/类
public void onDrawFrame(GL10 gl) {
/*
* By default, OpenGL enables features that improve quality
* but reduce performance. One might want to tweak that
* especially on software renderer.
*/
gl.glDisable(GL10.GL_DITHER);
gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
GL10.GL_MODULATE);
/*
* Usually, the first thing one might want to do is to clear
* the screen. The most efficient way of doing this is to use
* glClear().
*/
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glEnable(GL10.GL_CULL_FACE);
/*
* Now we're ready to draw some 3D objects
*/
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glActiveTexture(GL10.GL_TEXTURE0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
GL10.GL_REPEAT);
gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
GL10.GL_REPEAT);
long time = SystemClock.uptimeMillis() % 4000L;
// Rock back and forth
double animationUnit = ((double) time) / 4000;
float unitAngle = (float) Math.cos(animationUnit * 2 * Math.PI);
float angle = unitAngle * 135f;
gl.glEnable(GL11Ext.GL_MATRIX_PALETTE_OES);
gl.glMatrixMode(GL11Ext.GL_MATRIX_PALETTE_OES);
GL11Ext gl11Ext = (GL11Ext) gl;
// matrix 0: no transformation
gl11Ext.glCurrentPaletteMatrixOES(0);
gl11Ext.glLoadPaletteFromModelViewMatrixOES();
// matrix 1: rotate by "angle"
gl.glRotatef(angle, 0, 0, 1.0f);
gl11Ext.glCurrentPaletteMatrixOES(1);
gl11Ext.glLoadPaletteFromModelViewMatrixOES();
mGrid.draw(gl);
gl.glDisable(GL11Ext.GL_MATRIX_PALETTE_OES);
}