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


Java GL.glRotated方法代碼示例

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


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

示例1: glOrientToPlane

import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
 * orient the scene to the sketch plane.  
 * @param gl
 */
public void glOrientToPlane(GL gl){
	//gl.glLoadIdentity();
	// align to origin
	gl.glTranslated(origin.getX(), origin.getY(), origin.getZ());
	
	// rotate to align planes
	double xRot = getRotationX();
	double yRot = getRotationY();
	gl.glRotated(xRot*180.0/Math.PI, 1.0, 0.0, 0.0);
	gl.glRotated(yRot*180.0/Math.PI, 0.0, 1.0, 0.0);
	
	// rotate around z-axis to align 2D grid
	double zRot = getRotationZ();
	gl.glRotated(zRot*180.0/Math.PI, 0.0, 0.0, 1.0);
	//System.out.println("xRot:" + xRot + " yRot:" + yRot + " zRot:" + zRot);
}
 
開發者ID:avoCADo-3d,項目名稱:avoCADo,代碼行數:21,代碼來源:SketchPlane.java

示例2: renderRotation

import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
     * Draw rotation arrow 
     * @param gl
     * @param color What color should arrow be
     * @param center Where is center of arrow
     * @param rotation In what direction does arrow points
     */
    private void renderRotation(GL gl, GlColor color, Location center, Rotation rotation) {
        gl.glPushMatrix();
        {
            gl.glTranslated(center.x, center.y, center.z);

            Location endOfArrow = rotation.toLocation().getNormalized().scale(SPHERE_RADIUS * 2.5);

            gl.glBegin(GL.GL_LINES);
            gl.glColor4d(color.r, color.g, color.b, color.a);
            gl.glVertex3d(0, 0, 0);
            gl.glVertex3d(endOfArrow.x, endOfArrow.y, endOfArrow.z);
            gl.glEnd();

            gl.glTranslated(endOfArrow.x, endOfArrow.y, endOfArrow.z);
            // XXX: This works only in 2D, not 3D, because I am not in the mood
            // to figure out direction of Roll, Yaw and Pitch as well as order of
            // transformations. And rotation.toLocation() returns 2D coords anyway.


            double yaw = rotation.getYaw() / 32767 * 180; // left right, aka around z
            double roll = rotation.getRoll() / 32767 * 180; // clockwise/counter? around x
            double pitch = rotation.getPitch() / 32767 * 180; // up and down,  around y

            /*
            gl.glRotated(pitch, );
            gl.glRotated(yaw, );
            gl.glRotated(roll, );
             */
//            return res.mul(pitch).mul(yaw).mul(roll);

            if (logger.isLoggable(Level.FINE)) logger.fine(" Rotation: Yaw " + yaw + " roll " + roll + " pitch " + pitch);

            //gl.glRotated(roll, 1,0,0);
            gl.glRotated(yaw, 0, 0, 1);
            //gl.glRotated(pitch, 0,1,0);

            gl.glRotated(90, 0, 1, 0);

            glut.glutSolidCone(20, 40, 16, 16);
        }
        gl.glPopMatrix();

    }
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:51,代碼來源:UTAgentSubGLRenderer.java


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