简体   繁体   English

glOrtho不起作用

[英]glOrtho not working

I have a problem using glOrtho in a program that uses GLMDraw() function of GLM library to draw Google SketchUp 3D images. 我在使用GLM库的GLMDraw()函数绘制Google SketchUp 3D图像的程序中使用glOrtho时遇到问题。 I wanted to see the image for only certain values of z in Projection mode and glOrtho() didn't seem to work so I made the following code to test it: 我只想在“投影”模式下只看到z的某些值的图像,而glOrtho()似乎不起作用,因此我编写了以下代码对其进行测试:

glOrtho(0.0f, 2.0f, 0.0f, 2.0f, 0.0f, 0.0f);

Since near and far planes are the same I thought I should see no image but I see the whole image. 由于近平面和远平面是相同的,所以我认为我应该看不到任何图像,但可以看到整个图像。 What I am missing? 我缺少什么?

If you call glOrtho with znear=zfar, it generates a GL_INVALID_VALUE error, and probably just discards the call. 如果使用znear = zfar调用glOrtho,它将生成GL_INVALID_VALUE错误,并且可能只是放弃了该调用。

http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml

Try giving it a range greater than zero. 尝试给它一个大于零的范围。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM