本文介绍了GluProject不工作...如果对象富人Z =和-1.0F它缩小到(0.01F,0.01F,0.0)至极参数我要传递给GluProject?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到现在为止,我曾与 gluProject ,透视投影,在屏幕中央与左下顶点(-1,-1,0)可缩放的方形。我放大广场调节Z轴。

until now, I worked with gluProject, perspective projection, and a zoomable square centered on the screen with a lower left vertex (-1,-1,0). I zoom the square adjusting the Z axis.

例如,我缩放广场上Z = -5,以及我称之为 gluProject 与OpenGL的对象参数(-1,-1,0)知道窗口像素X,正方形顶点的Y位置。它工作正常。

For example, I zoomed the square to Z=-5, and I call gluProject with the openGL object parameters (-1,-1,0) to know the window pixels X,Y position of that vertex of the square. It works fine.

但现在,我changued我的建筑,现在我没有使用Z到缩小,我缩放放大。我在Z =的-1.0F广场,最初它被缩小到(0.01F,0.01F,0.0),是一个小广场。

But now, I changued my architecture, and now I'm not using Z to zoom, I'm scaling to zoom. I have the square at Z=-1.0f, and initially it is scaled to (0.01f,0.01f,0.0f), is a small square.

至极X,Y,Z值我要传递给 gluProject ?我路过-1,-1.0和 gluProject 是给我erroneal X,Y outPutCoords值,(-101.774124,-226.27419)

Wich X,Y,Z values I have to pass to gluProject? I'm passing -1,-1,0, and gluProject is giving me erroneal x,y outPutCoords values, (-101.774124,-226.27419)

推荐答案

再,再而三: gluProject 不完全一样的东西一样OpenGL的转换管道(好象叫使用OpenGL的矩阵和视口,当然)。所以,你要送什么OpenGL的顶点,这些都是你必须把顶点到 gluProject

Again and again and again: gluProject does exactly the same thing like the OpenGL transformation pipeline (if called with OpenGL's matrices and viewport, of course). So whatever vertices you send to OpenGL, these are the vertices you have to put into gluProject.

如果您使用渲染顶点(-1,-1,0)的多边形,然后你必须调用 gluProject 这个顶点。每隔转换(无论是平移,缩放,旋转,或其他)来自变换矩阵。但是,如果你确实使用了顶点渲染多边形(0.01,0.01,0),那么你必须把这个变成 gluProject

If you render the polygon using the vertex (-1,-1,0), then you have to call gluProject with this vertex. Every other transformation (be it translation, scaling, rotation, or whatever) comes from the transformation matrices. But if you indeed render the polygon using the vertex (0.01, 0.01, 0), then you have to put this into gluProject.

请确保你完全理解了OpenGL转换管道(答案可能有所帮助)的运作 gluProject 然后再继续使用它,并张贴了每一个小输入你想给出错误结果的问题。

Make sure you completely understand the OpenGL transformation pipeline (the answers to this question may help) and the workings of gluProject before continuing to use it and posting questions for every little input that you think gives wrong results.

这篇关于GluProject不工作...如果对象富人Z =和-1.0F它缩小到(0.01F,0.01F,0.0)至极参数我要传递给GluProject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:36