opengl光照问题
我已经加载了一个对象,当我绘制该对象时,我将颜色设置为绿色.. 绘制对象后,我用红色绘制线条。
一切都很顺利。当我输入照明属性时,问题就出现了。 当我创建光源时,光投射的所有物体都会变成白色。 为什么灯光会覆盖我的颜色?我该如何解决这个问题?
提前致谢..
I have loaded an object, and when I draw the object, I set the color to green..
After drawing the object, I draw lines in red.
It all worked out fine. The problem arise when I input lighting properties.
When I create a light source, everything where the light projects becomes white.
Why does the lighting over writes my color? And how do I solve this problem?
Thanks in advance..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您拥有的代码将有助于诊断问题。这听起来像是为物品设置材质(定义它们如何与灯光交互)的问题。
您可能需要查看 glColorMaterial 函数。以下代码片段将对此进行设置:
The code you have would help in diagnosing the problem. This sounds like a problem with setting up the materials for the items (which define how they interact with the lights).
You may want to look into the glColorMaterial function. The following snippet of code will set this up: