OpenGL - glVertex 替换绘制点?
在下面的 OpenGL 代码中,会发生什么?
glNormal3f( nx1, ny1, nz1 )
glVertex3f( x1,y1,z1 )
glNormal3f( nx2, ny2, nz2 ) //different Normal
glVertex3f( x1,y1,z1 ) //same vector
用言语来说:
我有一个带有法线的点,如果我用另一个法线再次创建该点,该点会更改其旧的法线向量,还是忽略最后一次调用?
当我试图以更平滑的方式渲染带有照明的球体时,出现了这个问题 使用法线。
In the following OpenGL code, what happens?
glNormal3f( nx1, ny1, nz1 )
glVertex3f( x1,y1,z1 )
glNormal3f( nx2, ny2, nz2 ) //different Normal
glVertex3f( x1,y1,z1 ) //same vector
In words:
I have a point with a normal, If I create the point again with another normal, the point changes his old normal vector, or ignores the last call?
This question came about when I was trying to render a sphere with lighting in a smoother way
using the normals.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
glNormal3f()
只是设置当前法线,该法线将保持这种状态直到下一次glNormal3f()
调用。每个
glVertex3f()
复制当前的法线、颜色和纹理坐标,并将完整的顶点提交到GL命令队列。glNormal3f()
just sets the current normal, which will stay that way until the nextglNormal3f()
call.Each
glVertex3f()
copies off the current normal, color, and texture coordinates and submits a complete vertex to GL command queue.它只会将两者绘制在完全相同的位置。幕后并没有什么神奇之处,即点被“识别”为位于同一位置,更新法线等。
It will simply draw both in exactly the same location. There is no magic behind the scenes where points are "recognized" as being in the same location, updating normals and such.