Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 100dp X 100dp 的正方形视图,我想用 opengl 做同样大小的正方形。
我的问题是如何控制正方形的大小?
在 opengl 中,我们有曲面的顶点、z 坐标和 gluPerspective 函数(fovy)的角度
私有浮点 [] 顶点 = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f }
fovy = 45.0
z = ??
我应该如何计算我的正方形的大小???
如果您只想绘制相同大小的正方形,则可能需要正交投影,并将所有变换设置为身份。
那么正方形的大小将等于它在屏幕上的大小。