设置视口以获得更大的顶点值? iPhone - OpenGL ES
我正在处理一些从 DAE 文件解析的较大顶点值。例如:
{-79.6536, -2230.43, -213.8},{-79.6536, 2377.36, -213.8},{79.6536, 2377.36, -213.8},{79.6536, -2230.43, -213.8},{-79.6536, -2230.43, 958.953},{79.6536, -2230.43, 958.953},{79.6536, 2377.36, 958.953},{-79.6536, 2377.36, 958.953},...
我的问题是我需要对视口的设置进行哪些更改才能适应这些较大的顶点?我目前有以下内容:
- (void)setupView
{
// Set up the window that we will view the scene through
glViewport(0, 0, backingWidth, backingHeight);
// switch to the projection matrix and setup our 'camera lens'
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
// switch to model mode and set our background color
glMatrixMode(GL_MODELVIEW);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}
但是,当我运行代码时,我只是得到一个充满白色的屏幕 - 我想是因为我的对象放大到了极限。
感谢您提前提供任何建议。
I am working with some larger vertice values which I have parsed from a DAE file. E.g :
{-79.6536, -2230.43, -213.8},{-79.6536, 2377.36, -213.8},{79.6536, 2377.36, -213.8},{79.6536, -2230.43, -213.8},{-79.6536, -2230.43, 958.953},{79.6536, -2230.43, 958.953},{79.6536, 2377.36, 958.953},{-79.6536, 2377.36, 958.953},...
My question is what changes do I need to make to the setting up of my viewport in order to accomodate these larger vertices ? I currently have the following :
- (void)setupView
{
// Set up the window that we will view the scene through
glViewport(0, 0, backingWidth, backingHeight);
// switch to the projection matrix and setup our 'camera lens'
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
// switch to model mode and set our background color
glMatrixMode(GL_MODELVIEW);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}
However when I run the code, I just get a screen filled with white - I presume because my object is zoomed in to an extreme degree.
Thanks for any advice in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

使用glScalef(max_s, max_s, max_s);
其中
Use
glScalef(max_s, max_s, max_s);
Where