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


Java GLU.gluOrtho2D方法代码示例

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


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

示例1: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	gl.glViewport(0, 0, width, height);
	mViewportWidth = width;
	mViewportHeight = height;

	float ratio = (float) width / height;
	mViewRect.top = 1.0f;
	mViewRect.bottom = -1.0f;
	mViewRect.left = -ratio;
	mViewRect.right = ratio;
	updatePageRects();

	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();
	if (USE_PERSPECTIVE_PROJECTION) {
		GLU.gluPerspective(gl, 20f, (float) width / height, .1f, 100f);
	} else {
		GLU.gluOrtho2D(gl, mViewRect.left, mViewRect.right,
				mViewRect.bottom, mViewRect.top);
	}

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:ichason,项目名称:PageCurl,代码行数:26,代码来源:CurlRenderer.java

示例2: draw2D

import android.opengl.GLU; //导入方法依赖的package包/类
private void draw2D(GL10 gl, boolean actionPlaneDrawn) {
	gl.glDisable(GL10.GL_DEPTH_TEST);
	gl.glDisable(GL10.GL_CULL_FACE);

	gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
	gl.glEnable(GL10.GL_BLEND);

	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();
	GLU.gluOrtho2D(gl, -1.0f, 1.0f, -1.0f, 1.0f);

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();

	ui.draw(gl, actionPlaneDrawn);

	gl.glEnable(GL10.GL_DEPTH_TEST);
	gl.glEnable(GL10.GL_CULL_FACE);
}
 
开发者ID:yurisuzukiltd,项目名称:AR-Music-Kit,代码行数:20,代码来源:MusicBoxRenderer.java

示例3: setSize

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void setSize(final int width, final int height) {
    mScreenWidth = width;
    mScreenHeight = height;
    mAlpha = 1.0f;

    final GL11 gl = mGL;
    gl.glViewport(0, 0, width, height);
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    GLU.gluOrtho2D(gl, 0, width, 0, height);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();

    final float matrix[] = mMatrixValues;
    Matrix.setIdentityM(matrix, 0);
    // to match the graphic coordinate system in android, we flip it vertically.
    Matrix.translateM(matrix, 0, 0, height, 0);
    Matrix.scaleM(matrix, 0, 1, -1, 1);
}
 
开发者ID:Git-tl,项目名称:appcan-plugin-pdfreader-android,代码行数:22,代码来源:GLCanvasImpl.java

示例4: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int w, int h) {	
	gl.glViewport(0,0,w,h);
	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();

	if(w < h) {
		GLU.gluOrtho2D(gl, 0,320,0,480);
		mWidth = 320;
		mHeight = 480;
	} else {
		GLU.gluOrtho2D(gl, 0,480,0,320);
		mWidth = 480;
		mHeight = 320;
	}


	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:20,代码来源:GLGameView.java

示例5: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
/**
 * Called when the OpenGL surface is recreated without destroying the
 * context.
 */
// This is a GLSurfaceView.Renderer callback
public void onSurfaceChanged(GL10 gl1, int width, int height) {
    Log.v(TAG, "onSurfaceChanged: " + width + "x" + height
            + ", gl10: " + gl1.toString());
    GL11 gl = (GL11) gl1;
    mGL = gl;
    gl.glViewport(0, 0, width, height);

    gl.glMatrixMode(GL11.GL_PROJECTION);
    gl.glLoadIdentity();

    GLU.gluOrtho2D(gl, 0, width, 0, height);
    Matrix matrix = mTransformation.getMatrix();
    matrix.reset();
    matrix.preTranslate(0, getHeight());
    matrix.preScale(1, -1);
}
 
开发者ID:yinglovezhuzhu,项目名称:AndroidMedia,代码行数:22,代码来源:GLRootView.java

示例6: onSurfaceCreated

import android.opengl.GLU; //导入方法依赖的package包/类
@Override public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    gl.glClearColor(0.0f, 0.0f, 0.0f, 1);
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
    gl.glShadeModel(GL10.GL_FLAT);
    gl.glDisable(GL10.GL_DEPTH_TEST);

    // Alpha support.
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

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

    GLU.gluOrtho2D(gl, 0, getWidth(), getHeight(), 0);
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:16,代码来源:GLFieldView.java

示例7: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	gl.glViewport(0, 0, height, height);
	mViewportWidth = height;
	mViewportHeight = height;
	Log.d("MviewPorTWidth", "" + mViewportWidth);
	/**
	 * @ TODO inja mViewRect Mige man che baazeE az OpenGL ro mitoonam
	 * bebinam, alan ino gozashtam 1.1 hamasho, chon mikham kami bozorgtar
	 * az kaaghaz bashe view ye page, yekam fazaaye khaali dashte bashe
	 */
	if (first) {
		mViewRect.top = 1.2f;
		mViewRect.bottom = -1.2f;
		// -ratio
		mViewRect.left = -1.2f;
		mViewRect.right = 1.2f;
		updatePageRects();

		gl.glMatrixMode(GL10.GL_PROJECTION);
		gl.glLoadIdentity();
		if (USE_PERSPECTIVE_PROJECTION) {
			GLU.gluPerspective(gl, 20f, (float) width / height, .1f, 100f);
		} else {
			GLU.gluOrtho2D(gl, mViewRect.left, mViewRect.right,
					mViewRect.bottom, mViewRect.top);
		}
		first = false;
	}

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:AmulaySoftGroup,项目名称:TaBeTa,代码行数:34,代码来源:CurlRenderer.java

示例8: stencil

import android.opengl.GLU; //导入方法依赖的package包/类
private void stencil(GL10 gl, float width, float height){
        
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluOrtho2D(gl, 0, width, 0, height);
        
        gl.glMatrixMode(GL10.GL_MODELVIEW);  
        gl.glLoadIdentity(); 

         gl.glEnable(GL10.GL_STENCIL_TEST);
         gl.glClearStencil(0);
         gl.glDisable(GL_SCISSOR_TEST);
// 		 gl.glDisable(GL_SCISSOR_BOX);
         gl.glClear(GL10.GL_STENCIL_BUFFER_BIT);
         gl.glEnable(GL_SCISSOR_TEST);
// 		 gl.glEnable(GL_SCISSOR_BOX);
         gl.glStencilOp (GL10.GL_REPLACE, GL10.GL_REPLACE, GL10.GL_REPLACE); // colorbuffer is copied to stencil
         gl.glDisable(GL10.GL_DEPTH_TEST);
         gl.glStencilFunc(GL10.GL_ALWAYS,1,1); // to avoid interaction with stencil content
        
         
        gl.glLoadIdentity();

        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, m_stencil_vers);
        gl.glLineWidth(1);
        //gl.glColor4f(1,1,1,0);     // alfa is 0 not to interfere with alpha tests
        gl.glDrawArrays(GL10.GL_LINES, 0, (int)width);
        
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        
        gl.glStencilOp (GL10.GL_KEEP, GL10.GL_KEEP, GL10.GL_KEEP); // disabling changes in stencil buffer
        gl.glFlush();
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnable(GL10.GL_DEPTH_TEST);
    }
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:38,代码来源:WiGalleryOpenGLRenderer.java

示例9: setSize

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void setSize(int width, int height) {
    Assert.assertTrue(width >= 0 && height >= 0);

    if (mTargetTexture == null) {
        mScreenWidth = width;
        mScreenHeight = height;
    }
    mAlpha = 1.0f;

    GL11 gl = mGL;
    gl.glViewport(0, 0, width, height);
    gl.glMatrixMode(GL11.GL_PROJECTION);
    gl.glLoadIdentity();
    GLU.gluOrtho2D(gl, 0, width, 0, height);

    gl.glMatrixMode(GL11.GL_MODELVIEW);
    gl.glLoadIdentity();

    float matrix[] = mMatrixValues;
    Matrix.setIdentityM(matrix, 0);
    // to match the graphic coordinate system in android, we flip it vertically.
    if (mTargetTexture == null) {
        Matrix.translateM(matrix, 0, 0, height, 0);
        Matrix.scaleM(matrix, 0, 1, -1, 1);
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:28,代码来源:GLES11Canvas.java

示例10: setupMatrices

import android.opengl.GLU; //导入方法依赖的package包/类
private void setupMatrices(GL10 gl) {
  // Save the matrix values.
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();

  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPushMatrix();
  float left = mWidth / 2;
  float bottom = mHeight / 2;
  gl.glLoadIdentity();
  GLU.gluOrtho2D(gl, left, -left, bottom, -bottom);
}
 
开发者ID:sky-map-team,项目名称:stardroid,代码行数:14,代码来源:OverlayManager.java

示例11: setSize

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void setSize(int width, int height) {
    UtilsBase.assertTrue(width >= 0 && height >= 0);

    if (mTargetTexture == null) {
        mScreenWidth = width;
        mScreenHeight = height;
    }
    mAlpha = 1.0f;

    GL11 gl = mGL;
    gl.glViewport(0, 0, width, height);
    gl.glMatrixMode(GL11.GL_PROJECTION);
    gl.glLoadIdentity(); // 把矩阵设为单位矩阵
    GLU.gluOrtho2D(gl, 0, width, 0, height);

    gl.glMatrixMode(GL11.GL_MODELVIEW);
    gl.glLoadIdentity();

    float matrix[] = mMatrixValues;
    Matrix.setIdentityM(matrix, 0);
    // to match the graphic coordinate system in android, we flip it vertically.
    if (mTargetTexture == null) {
        Matrix.translateM(matrix, 0, 0, height, 0);
        Matrix.scaleM(matrix, 0, 1, -1, 1);
    }
}
 
开发者ID:jituo666,项目名称:WoTu,代码行数:28,代码来源:GLCanvasImpl.java

示例12: gluOrtho2D

import android.opengl.GLU; //导入方法依赖的package包/类
/**
 * Sets the projection to the ortho matrix
 */
public void gluOrtho2D(GL10 gl)
{
	gl.glDisable(GL10.GL_DEPTH_TEST);
	
    gl.glMatrixMode( GL10.GL_PROJECTION );
    gl.glLoadIdentity();
    GLU.gluOrtho2D( gl, 0, mScreenWidth, 0, mScreenHeight );
    gl.glMatrixMode( GL10.GL_MODELVIEW );
    gl.glLoadIdentity();
}
 
开发者ID:wagoodman,项目名称:StackAttack,代码行数:14,代码来源:GLRenderer.java

示例13: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    this.width = width;
    this.height = height;

    gl.glViewport(0, 0, width, height);

    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    GLU.gluOrtho2D(gl, 0, width, 0, height);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:15,代码来源:LightOnWater.java

示例14: onDrawFrame

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public synchronized void onDrawFrame(GL10 gl) {

	if (CreatePNG) {
		saveBmp(gl);
		CreatePNG = false;

	}
	mObserver.onDrawFrame();
	// glClearColor miad rangi ke maa entekhaab kardim ro tooye carde
	// Graphic register mikone
	gl.glClearColor(Color.red(mBackgroundColor) / 255f,
			Color.green(mBackgroundColor) / 255f,
			Color.blue(mBackgroundColor) / 255f,
			Color.alpha(mBackgroundColor) / 255f);
	// glClear miad oon rangi ke bala register karde boodim ro dige az
	// buffer paak mikone
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

	// miad matris ro be MabdaEsh barmigardoone, ke bAd baraye glRotate va
	// glTranslate moshkeli ijaad nashe
	// chon maa asle jaabejaa kardan hamoon baraye safhe, baste be makaane
	// avalieye
	// kaaghazemoon hast, na oon makani ke dar haale hazer gharaar dare
	gl.glLoadIdentity();
	if (capture) {
		// Log.e("Capturing..", "Capturing..");
		if (BeforeStart) {
			// Log.e("BeforeStartCalled", "BeforeStartCalled");
			frameBuffer.BeforeStart(gl);
			BeforeStart = false;
		}
		if (AttachTexture) {
			// Log.e("SETUP", "SETUP Ran");
			int h = gl.glGetError();
			frameBuffer.setup(gl);
			if (h != 0) {
				// Log.d("ERROR", "ERROR Happend" + h + "");
			}
			AttachTexture = false;
		}
		frameBuffer.RenderStart(gl);
		if (USE_PERSPECTIVE_PROJECTION) {
			double x = mCurlMesh.GetMinX() * mCurlMesh.GetMinY();
			gl.glTranslatef((float) (-1.000 - mCurlMesh.GetMinX()),
					(float) (-1.000 - mCurlMesh.GetMinY()), -6f);
		}
		gl.glMatrixMode(GL10.GL_PROJECTION);
		gl.glLoadIdentity();
		GLU.gluOrtho2D(gl, (float) mCurlMesh.GetMinX(),
				(float) mCurlMesh.GetMaxX(), (float) mCurlMesh.GetMinY(),
				(float) mCurlMesh.GetMaxY());
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		gl.glLoadIdentity();
		gl.glViewport(0, 0, texW, texH);
		mCurlMesh.onDrawFrame(gl, false);

		frameBuffer.RenderEnd(gl);

	}

	// Reset Every Thing to Its Normal State
	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();
	GLU.gluOrtho2D(gl, -1.2f, 1.2f, -1.2f, 1.2f);
	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
	gl.glViewport(0, 0, mViewportWidth, mViewportHeight);

	mCurlMesh.onDrawFrame(gl, true);
	// Log.e("Rendered", "Rendered");

	if (DelPrevious) {
		// Log.e("DeleTing", "Deleting Texture = " +DelTextureId[0]);
		gl.glDeleteTextures(1, DelTextureId, 0);
		DelPrevious = false;
		Counter++;
	}
	DoneRender = true;
}
 
开发者ID:AmulaySoftGroup,项目名称:TaBeTa,代码行数:81,代码来源:CurlRenderer.java


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