當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。