当前位置: 首页>>代码示例>>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;未经允许,请勿转载。