Bug 958 : OpenGL rendering is more dim/darker in release 0149 and later
Last modified: 2009-02-19 18:25




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
fry
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-10-17 07:46
Due to a minor regression in how lighting or coloring is handled, sketches
with the OPENGL renderer setting are slightly more dark when run with more
recent releases. This will be fixed in a future release.
Additional Comment #1 From davbol 2009-02-04 14:30
1.0.1, WinXPsp3, included JRE.

as of 1.0.1 revisions.txt still asks for help tracking this down... have you found it yet?

If not, i believe at least part of the problem is that ambient light no longer has any
effect. f.e., the following sketch will draw a (flat lit) orange box with 0148, and a
black (unlit) box with 1.0.1:

import processing.opengl.*;
void setup() {
size(300,300,OPENGL);
}
void draw() {
translate(width/2f,height/2f,0f);
ambientLight(255,128,64);
rotateX(PI/4f);
rotateY(PI/4f);
box(100);
}

(the default ambient value specified with lights() similarly has no effect)
Additional Comment #2 From fry 2009-02-05 06:52
No, I haven't had time to track it down yet. That's odd--I was looking into
the ambient light settings but I wonder why it stopped having any effect.
Let me know if you find anything else. Thanks!
Additional Comment #3 From davbol 2009-02-06 14:15
I think it's a simple fix, tho caveat is that I hadn't realized how much the code had
been restructured as of 1.0, so i defer to the expert to double-check that this is
correct/complete. :)

I think it's just some missing "super." calls in PGraphicsOpenGL. Such that
ambientR|G|B (as well as specular and emissive) aren't getting set, to v[AR|etc]
values don't get set, so no effect by the time they reach applyLightingContribution().

In ambientFromCalc(), if you add super.ambientFromCalc(), that appears to fix the
code given previously above.

Similarly...

specularFromCalc() -- will fix the "reflection" example

emissiveFromCalc() -- will fix the code from reference (tho reword it with a draw loop
for GL)
Additional Comment #4 From fry 2009-02-12 08:10
Awesome, thanks so much for tracking that down. It sounds about right, and
I'll give it a closer look in the next couple of days--I need to spend a
Saturday soon doing some bug fixes and get 1.0.2 out, but have been totally
swamped with work.
Additional Comment #5 From fry 2009-02-19 16:30
yep, that did the trick, now incorporated for 1.0.2. thanks again.
Additional Comment #6 From fry 2009-02-19 18:25
*** Bug 1105 has been marked as a duplicate of this bug. ***