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


Java GL10.glMatrixMode方法代码示例

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


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

示例1: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
    // clear Screen and Depth Buffer
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    gl.glMatrixMode(GL10.GL_MODELVIEW);     //Select The Projection Matrix
    gl.glLoadIdentity();                     //Reset The Projection Matrix

    // Drawing
    /*gl.glTranslatef(0.0f, 0.0f, -10.0f);        // move 10 units INTO the screen
                                            // is the same as moving the camera 10 units away
                                            // now the visible z range is from -9.9 to 90, and view port
                                            // is still the 480 * 800 screen . The fvof angle and y/x
                                            // does not change.
     * 
     */
    draw(gl);
    if (mbTakeSnapshot == true)	{
    	mbitmapScreenSnapshot = takeScreenSnapshot(gl);
    }
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:22,代码来源:OGLChart.java

示例2: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    mRenderListener.onSurfaceChanged(gl, width, height);

    mEngine.setUpScene();
    if (mEngine.isCameraActive() && mEngine.getCamera() != null)
        mEngine.getCamera().update(width, height);


    // Sets the current view port to the new size.
    gl.glViewport(0, 0, width, height);
    // Select the projection matrix
    gl.glMatrixMode(GL10.GL_PROJECTION);
    // Reset the projection matrix
    gl.glLoadIdentity();
    // Select the modelview matrix
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    // Reset the modelview matrix

    gl.glOrthof(0, width, height, 0, 0, 1f);
}
 
开发者ID:ondramisar,项目名称:AdronEngine,代码行数:22,代码来源:AdrGlRenderer.java

示例3: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的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

示例4: 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

示例5: endGLElements

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
void endGLElements(GL10 gl) {
    vertexListManager.end();

    gl.glEnable(GL10.GL_DITHER);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();

    gl.glLineWidth(2);

    vertexListManager.render(gl);
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:13,代码来源:GLFieldView.java

示例6: draw

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void draw(GL10 gl) {
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
    gl.glOrthof(camLeft, camRight, camTop, camBottom, -1, 1);
}
 
开发者ID:ondramisar,项目名称:AdronEngine,代码行数:9,代码来源:Camera.java

示例7: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    if (height == 0) height = 1;
    float aspect = (float) width / height;

    gl.glViewport(0, 0, width, height);
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glOrthof(-10.f, 10.f, 10.f / aspect, -10.f / aspect, 0.1f, 100.f);

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

}
 
开发者ID:PacktPublishing,项目名称:Building-Android-UIs-with-Custom-Views,代码行数:15,代码来源:GLDrawerES1.java

示例8: onSurfaceCreated

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {

//		gl.glClearColor(0f, 0f, 0f, 0.5f);

		
		//gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
		gl.glEnable(GL10.GL_BLEND);
//		 gl.glEnable(GL10.GL_TEXTURE_2D);     
//		 gl.glBlendFunc(GL10.GL_ONE, GL10.GL_SRC_COLOR);
		gl.glClearDepthf(1.0f);
		gl.glEnable(GL10.GL_DEPTH_TEST);
		gl.glDepthFunc(GL10.GL_LEQUAL);
		gl.glHint(3152, 4354);
		gl.glEnable(GL10.GL_NORMALIZE);
		gl.glShadeModel(GL10.GL_SMOOTH);

		gl.glMatrixMode(GL10.GL_PROJECTION);

		// Lighting
		gl.glEnable(GL10.GL_LIGHTING);
		gl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT, getFloatBufferFromArray(new  float[]{0.5f,0.5f,0.5f,1.0f}));// 全局环境光
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT_AND_DIFFUSE, new float[]{0.3f, 0.3f, 0.3f, 1.0f}, 0);
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, new float[] { 1000f, 1000f, 1000f, 1.0f }, 0);
		gl.glEnable(GL10.GL_LIGHT0);

	}
 
开发者ID:xhd-Git,项目名称:3DPrint-Controller,代码行数:28,代码来源:STLRenderer.java

示例9: onDrawFrame

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onDrawFrame(GL10 gl) {
    /*
     * 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);

    /*
     * Now we're ready to draw some 3D objects
     */

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
    gl.glTranslatef(0, 0, -2);

    /*
     * All the magic happens here. The rotation matrix mR reported by
     * SensorManager.getRotationMatrix() is a 4x4 row-major matrix.
     * We need to use its inverse for rendering. The inverse is
     * simply calculated by taking the matrix' transpose. However, since
     * glMultMatrixf() expects a column-major matrix, we can use mR
     * directly!
     */
    gl.glMultMatrixf(mR, 0);
    // some test code which will be used/cleaned up before we ship this.
    //gl.glMultMatrixf(mI, 0);

    gl.glVertexPointer(3, GL_FLOAT, 0, mVertexBuffer);
    gl.glColorPointer(4, GL_FLOAT, 0, mColorBuffer);
    gl.glDrawElements(GL_LINES, 6, GL_UNSIGNED_BYTE, mIndexBuffer);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:34,代码来源:CompassActivity.java

示例10: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height) {
    gl.glViewport(0, 0, width, height);

    /*
     * Set our projection matrix. This doesn't have to be done
     * each time we draw, but usually a new projection needs to
     * be set when the viewport is resized.
     */

    float ratio = (float) width / height;
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:15,代码来源:CompassActivity.java

示例11: onDrawFrame

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

    // Draw background color
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    // Set GL_MODELVIEW transformation mode
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();   // reset the matrix to its default state

    // When using GL_MODELVIEW, you must set the view point
    GLU.gluLookAt(gl, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

    // Draw square
    mSquare.draw(gl);

    // Create a rotation for the triangle

    // Use the following code to generate constant rotation.
    // Leave this code out when using TouchEvents.
    // long time = SystemClock.uptimeMillis() % 4000L;
    // float angle = 0.090f * ((int) time);

    gl.glRotatef(mAngle, 0.0f, 0.0f, 1.0f);

    // Draw triangle
    mTriangle.draw(gl);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:29,代码来源:MyGLRenderer.java

示例12: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    // Adjust the viewport based on geometry changes
    // such as screen rotations
    gl.glViewport(0, 0, width, height);

    // make adjustments for screen ratio
    float ratio = (float) width / height;
    gl.glMatrixMode(GL10.GL_PROJECTION);        // set matrix to projection mode
    gl.glLoadIdentity();                        // reset the matrix to its default state
    gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);  // apply the projection matrix
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:13,代码来源:MyGLRenderer.java

示例13: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
/**
 * Update view-port with the new surface
 * 
 * @param gl the surface
 * @param width new width
 * @param height new height
 */
public void onSurfaceChanged(GL10 gl, int width, int height) {
    // set view-port
    gl.glViewport(0, 0, width, height);
    // set projection matrix
    float ratio = (float) width / height;
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
}
 
开发者ID:peter10110,项目名称:Android-SteamVR-controller,代码行数:17,代码来源:CubeRenderer.java

示例14: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的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

示例15: onSurfaceChanged

import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
@Override
    public void onSurfaceChanged(GL10 gl, int width, int height) {
Log.d("OGLChart", "onSurfaceChanged : start, chart title is " + this.mstrChartTitle);
        if(height == 0) {                         //Prevent A Divide By Zero By
            height = 1;                         //Making Height Equal One
        }

        mdChartWindowHeight = height;
        mdChartWindowWidth = width;
        
        gl.glViewport(0, 0, width, height);     //Reset The Current Viewport

        gl.glMatrixMode(GL10.GL_PROJECTION);     //Select The Projection Matrix
        gl.glLoadIdentity();                     //Reset The Projection Matrix
        //Calculate The Aspect Ratio Of The Window, tan(28.0725/2) = 0.25
        //GLU.gluPerspective(gl, PROJECT_Y_OVERALL_ANGLE, (float)width / (float)height, PROJECT_Z_NEAR - 1, PROJECT_Z_FAR + 1);
        GLU.gluPerspective(gl, PROJECT_Y_OVERALL_ANGLE, (float)width / (float)height, PROJECT_Z_NEAR, PROJECT_Z_FAR);

		double dFarXLength = PROJECT_Z_FAR * Math.tan(PROJECT_Y_OVERALL_ANGLE * Math.PI / 360) * 2
				* width / height;
		double dFarYLength = PROJECT_Z_FAR * Math.tan(PROJECT_Y_OVERALL_ANGLE * Math.PI / 360) * 2;
        mp3OriginInTO = new Position3D(0, 0, (-PROJECT_Z_NEAR - PROJECT_Z_FAR)/2.0);
        double dFarMinFarXYLen = Math.min(dFarXLength, dFarYLength);
        mdXAxisLenInTO = dFarMinFarXYLen * 3/4;    //* 5 / 9;
        mdYAxisLenInTO = dFarMinFarXYLen * 3/4;    //* 5 / 9;;
        mdZAxisLenInTO = dFarMinFarXYLen * 3/4;    //* 5 / 9;;
		
        setMapperFROM2TO();
		update();
Log.d("OGLChart", "onSurfaceChanged : end");
    }
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:32,代码来源:OGLChart.java


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