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