本文整理汇总了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];
}
示例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];
}
示例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;
}
示例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];
}
}
示例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;
}