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


Java GL10.glPushMatrix方法代码示例

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


在下文中一共展示了GL10.glPushMatrix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawFadeVeil

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
private void drawFadeVeil(GL10 gl, float alpha) {
       gl.glMatrixMode(GL10.GL_PROJECTION);
       gl.glPushMatrix();

       // orthographic projection is easier to place a 2D object where I want on the screen...
       gl.glLoadIdentity();
       gl.glOrthof( 0, mWidth, 0, mHeight, -10, 10);

       // Allocate object if not done yet
       if (mFadeVeil==null) {
           mFadeVeil = new FadeOutVeil(mWidth,mHeight);
           mFadeVeil.setPosition(mWidth/2, -mHeight/2, 0f);
       }
       mFadeVeil.draw(gl, alpha);

       gl.glPopMatrix();
       gl.glMatrixMode(GL_MODELVIEW);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:19,代码来源:CoverRollLayout.java

示例2: drawTopFadeOutBand

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
private void drawTopFadeOutBand(GL10 gl) {
       gl.glMatrixMode(GL10.GL_PROJECTION);
       gl.glPushMatrix();

       // orthographic projection is easier to place a 2D object where I want on the screen...
       gl.glLoadIdentity();
       gl.glOrthof( 0, mWidth, 0, mHeight, -10, 10);

       // Allocate object if not done yet
       if (mFadeOutBand==null) {
           mFadeOutBand = new FadeOutBand(mWidth,FADEOUTBAND_HEIGHT);
           mFadeOutBand.setPosition(mWidth/2, -(mHeight-FADEOUTBAND_HEIGHT/2), 0f);
       }
       mFadeOutBand.draw(gl);

       gl.glPopMatrix();
       gl.glMatrixMode(GL_MODELVIEW);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:19,代码来源:CoverRollLayout.java

示例3: 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();
}
 
开发者ID:peter10110,项目名称:Android-SteamVR-controller,代码行数:20,代码来源:CubeRenderer.java

示例4: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
	public void onDrawFrame(GL10 gl) {
		if (bufferCounter < 1) {
			return;
		}
		bufferCounter--;

		gl.glLoadIdentity();
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

		gl.glTranslatef(positionX, -positionY, 0);

		// rotation and apply Z-axis
		gl.glTranslatef(0, 0, translation_z);
		gl.glRotatef(angleX, 0, 1, 0);
		gl.glRotatef(angleY, 1, 0, 0);
		scale_rember=scale_now*scale;
		gl.glScalef(scale_rember, scale_rember, scale_rember);
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		// draw X-Y field
		if (displayGrids) {
			drawGrids(gl);
		}

//		// draw axis
//		if (displayAxes) {
//			gl.glLineWidth(3f);
//			float[] vertexArray = { -100, 0, 0, 100, 0, 0, 0, -100, 0, 0, 100, 0, 0, 0, -100, 0, 0, 100 };
//			FloatBuffer lineBuffer = getFloatBufferFromArray(vertexArray);
//			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, lineBuffer);
//
//			// X : red
//			gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 1.0f, 0f, 0f, 0.75f }, 0);
//			gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 1.0f, 0f, 0f, 0.5f }, 0);
//			gl.glDrawArrays(GL10.GL_LINES, 0, 2);
//
//			// Y : blue
//			gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 0f, 0f, 1.0f, 0.75f }, 0);
//			gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 0f, 0f, 1.0f, 0.5f }, 0);
//			gl.glDrawArrays(GL10.GL_LINES, 2, 2);
//
//			// Z : green
//			gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, new float[] { 0f, 1.0f, 0f, 0.75f }, 0);
//			gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, new float[] { 0f, 1.0f, 0f, 0.5f }, 0);
//			gl.glDrawArrays(GL10.GL_LINES, 4, 2);
//		}

		// draw object
		if (stlObject != null) {

			gl.glMaterialfv(GL10.GL_FRONT, GL10.GL_AMBIENT, new float[] { 0.75f,0.75f,0.75f,1.0f }, 0);
			
			gl.glMaterialfv(GL10.GL_FRONT, GL10.GL_DIFFUSE, new float[] { 0.75f,0.75f,0.75f,1.0f }, 0);
			
			gl.glEnable(GL10.GL_COLOR_MATERIAL);
			gl.glPushMatrix();
			gl.glColor4f(red,green,blue, 1.0f);
			stlObject.draw(gl);
			gl.glPopMatrix();
			gl.glDisable(GL10.GL_COLOR_MATERIAL);
		}
	}
 
开发者ID:xhd-Git,项目名称:3DPrint-Controller,代码行数:65,代码来源:STLRenderer.java

示例5: drawMessageBox

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
protected void drawMessageBox(GL10 gl) {
	if (mMessageBox!=null) {

		gl.glMatrixMode(GL10.GL_PROJECTION);
		gl.glPushMatrix();

		// orthographic projection is easier to place a 2D object where I want on the screen...
		gl.glLoadIdentity();
		gl.glOrthof( 0, mWidth, 0, mHeight, -10, 10);

		// Center horizontally, bottom vertically (y sign is weird, linked to glOrthof above, but in a way I didn't figure out)
		mMessageBox.setPosition(mWidth/2, -mHeight/2, 0f);

		// Translation animation
		float[] labelTranslation = null;
		synchronized (mTranslationLock) {
			if (mTranslationXyz != null) {
				labelTranslation = new float[3];
				labelTranslation[0] = mTranslationXyz[0]*mWidth/2; // MAGICAL
				labelTranslation[1] = 0f; // don't slide label vertically
				labelTranslation[2] = 0f; // don't slide label in z
			}
		}
		//scrolling animation
		if (mGLobalLabelScroll!=0f) {
			if (labelTranslation == null) {
				labelTranslation = new float[] {mGLobalLabelScroll,0f,0f};
			} else {
				labelTranslation[0] += mGLobalLabelScroll;
			}
		}

		if (mDrawFocus) {
			mMessageBox.drawFocus(gl, labelTranslation);
		} else {
			mMessageBox.draw(gl, mMessageBoxAlpha, labelTranslation);
		}

		gl.glPopMatrix();
	}
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:42,代码来源:CoverLayout.java


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