本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}*/
}