0

I'm new with OpenGL and I read codes from different sources. I don't understand what function provide the change of object size with window.

Code 1 -> http://codepad.org/1kSTAMOF

Code 2 -> http://codepad.org/Gs7CeBW2

math3d header for Code 2 ->http://codepad.org/Ptz3XBkp

Code 3 ->http://codepad.org/rFMWUktw

For example; the Code 1 and Code 2 create triangles and their sizes change with window size. However the Code 3 creates lines and their sizes doesn't change with changing window size. I don't understand which line of codes provide these properties and what must I do for provide same property for Code 3?(I couldn't share all links as link format because I'm not allowed)

4

2 回答 2

0

宽度为 1.0 的线总是光栅化 1 像素宽。无论窗口大小如何,使用glLineWidth都会将绘制的所有线条的宽度更改为相同大小。

要获得随窗口大小(或更准确地说是视口大小)变化而缩放的线条,您需要将它们渲染为填充图元(即 OpenGL 或 OpenGL ES 中的 GL_TRIANGLES 或 GL_TRIANGLE_STRIP)。此处描述了您的问题的解决方案。它有点先进,但希望它对你有意义。

于 2013-01-25T04:55:21.290 回答
0

问题是,无论您放大多少或更改窗口大小,线的宽度都不会改变。使用 glLineWidth(width) 使线宽随窗口大小而变化

于 2013-01-24T23:07:59.330 回答