[英]OpenGL 3D Cube Rotation
So i have a 3D cube that and I have a matrix 3x3 that i transform to obtain an angle and an axis to use these as parameters in 所以我有一个3D多维数据集,并且我有一个3x3矩阵,我对其进行变换以获得一个角度和一个轴,以将它们用作参数
gl.glRotatef(angle, x, y, z); gl.glRotatef(angle,x,y,z);
However, the cube does not rotate properly and it seems like the method 但是,多维数据集无法正确旋转,并且看起来像方法
glTranslatef (float x, float y, float z) glTranslatef(浮点数x,浮点数y,浮点数z)
as a huge importance but i dont really know what it does .. Here is the code : 作为一个巨大的重要性,但我真的不知道它的作用..这是代码:
@Override
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -10.0f);
gl.glRotatef(angle, x, y, z);
mCube.draw(gl);
}
angle, x, y and z are the values i get after transforming the matrix. angle,x,y和z是变换矩阵后得到的值。
What am I doin wrong ? 我做错了什么?
Thank you. 谢谢。
What do you see when you run that program? 运行该程序时您会看到什么?
Just to make sure, the definition for glRotatef is here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd368577(v=vs.85).aspx 为确保确定,glRotatef的定义在此处: http : //msdn.microsoft.com/zh-cn/library/windows/desktop/dd368577( v=vs.85) .aspx
The 'angle' portion is in degrees. “角度”部分以度为单位。 I've made the mistake of handing it radians a few times, and it appears that my object isn't rotating.
我犯了几次错误的弧度错误,看来我的物体没有旋转。 Also, glTranslatef will move your object in the +/- xyz direction.
同样,glTranslatef也会沿+/- xyz方向移动对象。 Traditionally, +y is up, +x is right, and +z is into the screen.
传统上,+ y在上,+ x在右,+ z在屏幕上。 This can all change depending on a few different things, like your view matrix.
所有这些都可能根据一些不同的事物而改变,例如您的视图矩阵。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.