當前位置: 首頁>>代碼示例>>Java>>正文


Java GLU.gluLookAt方法代碼示例

本文整理匯總了Java中android.opengl.GLU.gluLookAt方法的典型用法代碼示例。如果您正苦於以下問題:Java GLU.gluLookAt方法的具體用法?Java GLU.gluLookAt怎麽用?Java GLU.gluLookAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLU的用法示例。


在下文中一共展示了GLU.gluLookAt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
    // clear frame
    gl.glClearColor(mR, mG, mB, mA);

    // Set GL_MODELVIEW transformation mode
    gl.glMatrixMode(GL10.GL_MODELVIEW);

    // reset the matrix to its default state
    gl.glLoadIdentity();

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

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
}
 
開發者ID:chartsai,項目名稱:GLESDemo,代碼行數:17,代碼來源:GLES1_Background_Activity.java

示例2: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
@Override public void onDrawFrame(GL10 gl)
{
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
	GLU.gluLookAt(gl, 0,0,-5, 0,0,0, 0,1,0);

	gl.glScalef(1.25f, 1.25f,1.25f);
	gl.glRotatef(tilt * 180 / (float) Math.PI, 1, 0, 0);
	gl.glRotatef(rotation * 180 / (float) Math.PI, 0, 0, 1);

	gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

	gl.glColor4f(0.8f,0.2f,0.2f,1);
	gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer);
	gl.glDrawElements(GL10.GL_TRIANGLE_FAN, indices.length, GL10.GL_UNSIGNED_BYTE, indexBuffer);
}
 
開發者ID:westnordost,項目名稱:StreetComplete,代碼行數:18,代碼來源:CompassView.java

示例3: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {

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

    GLU.gluLookAt(gl, eye.x, eye.y, eye.z, center.x,
            center.y, center.z, up.x, up.y, up.z);
    gl.glRotatef(mDegree , 0, 1, 0);
    gl.glScalef(mScalef, mScalef, mScalef);
    gl.glTranslatef(-mCenterPoint.x, -mCenterPoint.y, -mCenterPoint.z);

    gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

    gl.glNormalPointer(GL10.GL_FLOAT, 0, model.getVnormsBuffer());
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, model.getVertBuffer());
    gl.glDrawArrays(GL10.GL_TRIANGLES, 0, model.getFacetCount()*3);

    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
}
 
開發者ID:liudabao,項目名稱:OpenglDemo,代碼行數:23,代碼來源:GlModelRender.java

示例4: updateCamera

import android.opengl.GLU; //導入方法依賴的package包/類
/***
 * 更新攝像機
 * @param gl
 */
public void updateCamera(GL10 gl)
{
    //設置攝像機位置與觀察目標
    GLU.gluLookAt(gl,
            this._position.x,
            this._position.y,
            this._position.z,
            this._target.x,
            this._target.y,
            this._target.z,
            0.0f,
            1.0f,
            0.0f);
    //旋轉攝像機
    gl.glRotatef(this._rotation.x,1.0f,0.0f,0.0f);
    gl.glRotatef(this._rotation.y,0.0f,1.0f,0.0f);
    gl.glRotatef(this._rotation.z,0.0f,0.0f,1.0f);
}
 
開發者ID:liangxiegame,項目名稱:QuickES,代碼行數:23,代碼來源:Camera.java

示例5: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
	if(AugmentedModelViewerActivity.DEBUG) {
		frame++;
		time=System.currentTimeMillis();
		if (time - timebase > 1000) {
			Log.d("fps: ", String.valueOf(frame*1000.0f/(time-timebase)));
		 	timebase = time;		
			frame = 0;
		}
	}
	//String extensions = gl.glGetString(GL10.GL_EXTENSIONS);
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
	gl.glLoadIdentity();
	GLU.gluLookAt(gl, cameraPosition.x, cameraPosition.y, cameraPosition.z,
			0, 0, 0, 0, 1, 0);
	for (Iterator<Model3D> iterator = models.iterator(); iterator.hasNext();) {
		Model3D model = iterator.next();
		model.draw(gl);
	}
}
 
開發者ID:PavanKulhalli,項目名稱:andarch,代碼行數:22,代碼來源:Renderer.java

示例6: onSurfaceChanged

import android.opengl.GLU; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	float aspectRatio = (float) width / height;

	gl.glViewport(0, 0, width, height);
	
	gl.glLoadIdentity();
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

	if (stlObject != null) {
		Log.i("maxX:" + stlObject.maxX);
		Log.i("minX:" + stlObject.minX);
		Log.i("maxY:" + stlObject.maxY);
		Log.i("minY:" + stlObject.minY);
		Log.i("maxZ:" + stlObject.maxZ);
		Log.i("minZ:" + stlObject.minZ);
	}

	GLU.gluPerspective(gl, 45f, aspectRatio, 1f, 5000f);// (stlObject.maxZ - stlObject.minZ) * 10f + 100f);

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	GLU.gluLookAt(gl, 0, 0, 100f, 0, 0, 0, 0, 1f, 0);
}
 
開發者ID:fastbot3d,項目名稱:FastBot-Apk,代碼行數:24,代碼來源:STLRenderer.java

示例7: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
    if (animation != null) {
        animation.nextFrame();
    }

    gl.glClearColor(0.5f, 0.5f, 0.5f, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();

    GLU.gluLookAt(gl, eye[0], eye[1], eye[2], center[0], center[1], center[2], upVector[0], upVector[1], upVector[2]);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

    gl.glShadeModel(GL10.GL_FLAT);
    gl.glFrontFace(GL10.GL_SMOOTH);
    gl.glEnable(GL10.GL_DEPTH_TEST);

    Cube3.getInstance().draw(gl);

    gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
開發者ID:x6uderek,項目名稱:rubik,代碼行數:26,代碼來源:CubeRender.java

示例8: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 gl) {
	if(panorama != null) {
		gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluPerspective(gl, camera.getAdjustedFOV(), (float) width / (float) height, ZNEAR, ZFAR);
        gl.glMatrixMode(GL10.GL_MODELVIEW);
		
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
           gl.glLoadIdentity();
           
           float[] lookAt = camera.getLookAtVector();
        GLU.gluLookAt(gl, camera.getPositionX(), camera.getPositionY(), camera.getPositionZ(), lookAt[0], lookAt[1], lookAt[2], 0.0f, 1.0f, 0.0f);
           
        panorama.drawFrame(gl);
	}
}
 
開發者ID:murrple-1,項目名稱:PanoEngine-Android,代碼行數:18,代碼來源:PanoramaRenderer.java

示例9: run

import android.opengl.GLU; //導入方法依賴的package包/類
public void run() {
    initEGL();
    initGL();
    
    TriangleSmallGLUT triangle = new TriangleSmallGLUT(3);
    mGL.glMatrixMode(GL10.GL_MODELVIEW);
    mGL.glLoadIdentity();
    GLU.gluLookAt(mGL, 0, 0, 10f, 0, 0, 0, 0, 1, 0f);
    mGL.glColor4f(1f, 0f, 0f, 1f);
    while (!mDone) {
        mGL.glClear(GL10.GL_COLOR_BUFFER_BIT| GL10.GL_DEPTH_BUFFER_BIT);
        mGL.glRotatef(1f, 0, 0, 1f);
        
        triangle.drawColorful(mGL);
        //triangle.draw(mGL);
                        
        mEGL.eglSwapBuffers(mGLDisplay, mGLSurface);
    }
}
 
開發者ID:JimSeker,項目名稱:opengl,代碼行數:20,代碼來源:BasicGL.java

示例10: run

import android.opengl.GLU; //導入方法依賴的package包/類
public void run() {
    initEGL();
    initGL();
    

    CubeSmallGLUT cube = new CubeSmallGLUT(3);        

    mGL.glMatrixMode(GL10.GL_MODELVIEW);
    mGL.glLoadIdentity();
    GLU.gluLookAt(mGL, 0, 0, 8f, 0, 0, 0, 0, 1, 0f);
    while (!mDone) {
        if (animState) {
            mGL.glClear(GL10.GL_COLOR_BUFFER_BIT
                    | GL10.GL_DEPTH_BUFFER_BIT);
            mGL.glRotatef(1f, 1f, 1f, 1f);

            cube.draw(mGL);

            mEGL.eglSwapBuffers(mGLDisplay, mGLSurface);

            calculateAndDisplayFPS();
        }
    }
}
 
開發者ID:JimSeker,項目名稱:opengl,代碼行數:25,代碼來源:SimpleFPSDisplay.java

示例11: run

import android.opengl.GLU; //導入方法依賴的package包/類
public void run() {
    initEGL();
    initGL();
    
    CubeSmallGLUT cube = new CubeSmallGLUT(3);        
    mGL.glMatrixMode(GL10.GL_MODELVIEW);
    mGL.glLoadIdentity();
    GLU.gluLookAt(mGL, 0, 0, 8f, 0, 0, 0, 0, 1, 0f);
    while (!mDone) {
        mGL.glClear(GL10.GL_COLOR_BUFFER_BIT| GL10.GL_DEPTH_BUFFER_BIT);
        mGL.glRotatef(1f, 1f, 1f, 1f);
        mGL.glColor4f(1f, 0f, 0f, 1f);
        
        cube.draw(mGL);

        mGL.glFlush();
        mEGL.eglSwapBuffers(mGLDisplay, mGLSurface);
    }
}
 
開發者ID:JimSeker,項目名稱:opengl,代碼行數:20,代碼來源:SimpleLitGLCube.java

示例12: run

import android.opengl.GLU; //導入方法依賴的package包/類
public void run() {
    initEGL();
    initGL();
    
    CubeSmallGLUT cube = new CubeSmallGLUT(3);
    mGL.glMatrixMode(GL10.GL_MODELVIEW);
    mGL.glLoadIdentity();
    GLU.gluLookAt(mGL, 0, 0, 6f, 0, 0, 0, 0, 1, 0f);
    while (!mDone) {
        mGL.glClear(GL10.GL_COLOR_BUFFER_BIT| GL10.GL_DEPTH_BUFFER_BIT);
        mGL.glRotatef(1f, 1f, 1f, 1f);
        
        mGL.glColor4f(1f, 0f, 0f, 1f);

        cube.drawSimpleCube(mGL);
                        
        mEGL.eglSwapBuffers(mGLDisplay, mGLSurface);
    }
}
 
開發者ID:JimSeker,項目名稱:opengl,代碼行數:20,代碼來源:BasicGLCube.java

示例13: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void onDrawFrame(GL10 gl) {
	
	//Log.d("testAffichage","(" + this.mCamX + ", "+ this.mCamY + ", "+ this.mCamZ + ")");
	
	// clear Screen and Depth Buffer
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
	GLU.gluLookAt(gl, mCamX,mCamY,mCamZ, mCamX,mCamY,0, 0,1,0);
	
	//Draws the current floor map
	for(int i = 0; i < listFloorMap.size(); i++)
       {
		FloorMap carteEnCours = listFloorMap.get(i);
		if(carteEnCours.getFloor() <= this.currentFloor)
		{
			carteEnCours.draw(gl);
		}	
       }
	//Draws the current floor markers
	displayMarkers(gl);
}
 
開發者ID:BenjaminMesre,項目名稱:UPMCarte,代碼行數:28,代碼來源:MapGLRenderer.java

示例14: onDrawFrame

import android.opengl.GLU; //導入方法依賴的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

示例15: onDrawFrame

import android.opengl.GLU; //導入方法依賴的package包/類
public void onDrawFrame(GL10 gl) {

    	if (mPaused || gl == null) {
    		return;
    	}

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        try {
            GLU.gluLookAt(gl,
            		0f, 0f, mEyeDistance,	//eye
            		0f, 0f, 0f,   			//center
            		0f, 1.0f, 0.0f); 		//up
        } catch (GLException e) {
            Log.e(TAG, "onDrawFrame GLException", e);
            return;
        }

        // Rotate
        glRotatef(180f, 0, 0, 1.0f); // upside down
        glRotatef(- mTilt, 0, 1.0f, 0); // tilt

        // Draw covers
        synchronized (mLayoutLock) {
			mLayout.drawAll(gl);
		}

        // Click mark (debug)
        /*if ((DEBUG_PICKING) && (mClickPoint != null)) {
        	Mark m = new Mark(mClickPoint[0], mClickPoint[1], mClickPoint[2]);
        	m.draw(mGL, 1.0f);
        }*/
    }
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:36,代碼來源:CoversRenderer.java


注:本文中的android.opengl.GLU.gluLookAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。