1
\$\begingroup\$

I followed the Lighting tutorial on learnopenGL, modifying some of the code to work in a 2D game engine. Everything was looking great and my team got our game done and the lights were quite simple for our designers to use. However we ran into a rare bug. as shown here: https://www.youtube.com/watch?v=to0mMP5I0cs one team member was able to recreate the bug by switching his Nvidia settings to use the "High Performance Processor" as opposed to "Integrated Graphics". Otherwise everything renders properly. The bug doesn't appear when there are no lights and everything is rendered in its full color. We have gone through alot of Ideas already but they haven't worked and now I am at a loss. Does anyone have any ideas about what is going on?

\$\endgroup\$
  • 1
    \$\begingroup\$ Are you referring to the background? That actually looks quite cool. Can you reproduce that effect more reliably? :) \$\endgroup\$ – Philipp May 28 '18 at 18:35
  • \$\begingroup\$ Admittedly it does look cool, but the randomness is due to garbage values. but it's seizure inducing which is not what we wanted. The problem was the vec3 for color in the shader wasn't initialized and while some drivers default initialized it, others left it with garbage values. \$\endgroup\$ – Timothey Goodwin May 28 '18 at 22:59
3
\$\begingroup\$

Always make sure you initialize your variables. Apparently some cards and drivers automatically initialize vec3 to (0,0,0), but others don't. That was what was going on here. Garbage values causing different colors at each fragment. By Initializing my resulting color vec3 to (0,0,0) at the beginning the problem is fixed.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.