我正在使用 JOGL 库做一些事情(被迫),但我不知道如何偏移中心零坐标。我想在方法中将它们偏移到视口(viewport)的底部
public void reshape(GLAutoDrawabledrawable, int x, int y, int width, int height)
但我无法通过谷歌搜索任何方法将 int height 转换为任何有意义的偏移浮点坐标。
编辑:
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45.0, width / (float) height, 0.1, 100.0);
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
最佳答案
使用解决
glu.gluLookAt(0, 0, 1, 0, 0.42, 0, 0, 1, 0);
没有意识到偏移量不是相对的。
关于Java - OpenGL 设置中心 (0,0) 坐标的偏移量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15914374/