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


Java GLU.gluProject方法代碼示例

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


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

示例1: Project

import android.opengl.GLU; //導入方法依賴的package包/類
private void Project(float[] ObjXYZ, float [] WinXY)
{
	float [] matrix1 = new float[16];
	float [] matrix2 = new float[16];
	float [] matrix = new float[16];
	
	Matrix.setIdentityM(matrix1, 0);
	Matrix.setIdentityM(matrix2, 0);
	Matrix.setIdentityM(matrix, 0);
	
    Matrix.rotateM(matrix1, 0, rx, 1, 0, 0);
    Matrix.rotateM(matrix2, 0, ry, 0, 1, 0);
	Matrix.multiplyMM(matrix, 0, matrix1, 0, matrix2, 0);
    
    float xyz[]	= new float[3];
    xyz[0] = ObjXYZ[0];
    xyz[1] = ObjXYZ[1];
    xyz[2] = ObjXYZ[2];
    
    Transform(matrix, xyz);
    //Log.e("xyz", xyz[0] + " " + xyz[1] + " " + xyz[2]);
    float []Win = new float[3];
    GLU.gluProject(xyz[0], xyz[1], xyz[2], mod_matrix, 0, pro_matrix, 0, view_matrix, 0, Win, 0);
    WinXY[0] = Win[0];
    WinXY[1] = Win[1];
}
 
開發者ID:flexwang,項目名稱:HappyRubik,代碼行數:27,代碼來源:MagicCubeRender.java

示例2: getScreenCoordinates

import android.opengl.GLU; //導入方法依賴的package包/類
/**
 * Get the screen position of a given
 * {@link com.beyondar.android.util.math.geom.Point3 Point3}.
 * 
 * @param x
 *            The 3D position (x) to transform to a screen coordinates.
 * @param y
 *            The 3D position (y) to transform to a screen coordinates.
 * @param z
 *            The 3D position (z) to transform to a screen coordinates.
 * @param outPoint
 *            The object where the result will be stored.
 * @param eye
 *            Array where the eye position will be stored to do the
 *            calculations.
 */
public void getScreenCoordinates(float x, float y, float z, Point3 outPoint, float[] eye) {
	// far eye point
	if (eye == null) {
		eye = new float[4];
	} else {
		eye[0] = eye[1] = eye[2] = eye[3] = 0;
	}

	GLU.gluProject(x, y, z, mMatrixGrabber.mModelView, 0, mMatrixGrabber.mProjection, 0, viewport, 0,
			eye, 0);

	// fix
	if (eye[3] != 0) {
		eye[0] = eye[0] / eye[3];
		eye[1] = eye[1] / eye[3];
		eye[2] = eye[2] / eye[3];
	}

	// Screen coordinates
	outPoint.x = eye[0];
	outPoint.y = mHeight - eye[1];
	outPoint.z = eye[2];
}
 
開發者ID:BeyondAR,項目名稱:beyondar,代碼行數:40,代碼來源:ARRenderer.java

示例3: get2DCoord

import android.opengl.GLU; //導入方法依賴的package包/類
private static float[] get2DCoord(float x, float y, float z)
{       
         float[] ret = new float[4];
         //GLU.gluUnProject((float)x, (float)y, 0f, model, 0, proj, 0, view, 0, ret, 0);
         GLU.gluProject(x, y, z,  WiGalleryOpenGLRenderer.g_model, 0, WiGalleryOpenGLRenderer.g_proj, 0, WiGalleryOpenGLRenderer.g_viewArray, 0, ret, 0);

         
         return ret;
}
 
開發者ID:hubert1002,項目名稱:WiCamera3D,代碼行數:10,代碼來源:CSStaticData.java

示例4: updateScreenCoordinates

import android.opengl.GLU; //導入方法依賴的package包/類
private final void updateScreenCoordinates() {
	float[] screenPos = new float[3];
	// TODO FIXME XXX i think newPosition[2] has to be negative
	int result = GLU.gluProject(-newPosition[0], newPosition[1],
			newPosition[2], modelMatrix, 0, GLESCamera.projectionMatrix, 0,
			GLESCamera.viewportMatrix, 0, screenPos, 0);

	if (result == GL10.GL_TRUE) {
		screenCoordinates[0] = screenPos[0];
		screenCoordinates[1] = GLESCamera.viewportMatrix[3] - screenPos[1];
	}
}
 
開發者ID:52North,項目名稱:geoar-app,代碼行數:13,代碼來源:ARObject.java

示例5: onScreenCoordsUpdate

import android.opengl.GLU; //導入方法依賴的package包/類
public float[] onScreenCoordsUpdate() {
	if (modelMatrix == null || GLESCamera.projectionMatrix == null
			|| GLESCamera.viewportMatrix == null) {
		return null;
	}
	float[] output = new float[3];
	int res = GLU.gluProject(position[0], position[1], position[2],
			modelMatrix, 0, GLESCamera.projectionMatrix, 0,
			GLESCamera.viewportMatrix, 0, output, 0);

	if (res == GL10.GL_FALSE)
		return null;
	return output;
}
 
開發者ID:52North,項目名稱:geoar-app,代碼行數:15,代碼來源:RenderFeature2.java


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