简体   繁体   English

如何在JOGL中旋转圆柱体

[英]How to rotate a cylinder in JOGL

I have drawn a wire cylinder in JOGL and I want to make it stand up when it is coming out of the screen? 我在JOGL中绘制了一个线筒,当它从屏幕出来时我想让它站起来?

I've been messing around with the following code in order to do the rotate but it is not rotating: 我一直在乱以下代码,以便进行旋转,但它不旋转:

gl.glRotatef(cylinder_a, 0, 0, 90);

What is the correct way to rotate a cylinder in JOGL? 在JOGL中旋转圆柱的正确方法是什么?

According to the JOGL documentation for gl.glRotatef its arguments are angle , x , y , z . 根据gl.glRotatefJOGL文档,它的参数是anglexyz With the arguments 0 , 0 , 90 for x, y, z, you are defining the vector along +z, pointing out of the screen. 与参数0090为X,Y,Z,要定义沿+ Z的向量,指出的画面。 This means that you are rotating the cylinder about its axis, so the change isn't apparent. 这意味着您正在围绕其轴旋转圆柱体,因此更改不明显。 To make it stand "upright" you need to rotate it around the x axis. 要使其“直立”,您需要围绕x轴旋转它。

(You can change the way x, y, and z point in OpenGL, but usually +x points right, +y point up, and +z "comes out" from the screen. You can use the right hand rule to remember that.) (你可以改变OpenGL中x,y和z点的方式,但通常+ x指向右边,+ y指向上方,+ z从屏幕出来。你可以使用右手规则来记住它。 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM