Bug 169 : fill() ignored for textured shapes if all verticies coloured the same
Last modified: 2007-10-22 19:21




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

 

Reporter:
JohnG
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2005-10-12 07:25
If you try to draw a polygon with different coloured verticies, to create a
smooth transition of colour across a single polygon, it works, however, if
all the verticies have the same colour, the colouring is ignored, and none
is applied.

example code: (needs a texture, I use a simple white image with dark
patches to test)
[code]
PImage tex;

void setup()
{
size(300,300,P3D);
tex=loadImage("tex.jpg");
}

void draw()
{
background(0);
beginShape(TRIANGLES);
texture(tex);
fill(255,0,0);
vertex(50,50,0,0,0);
// fill(0,,255,0);
vertex(200,50,0,tex.width,0);
// fill(0,0,255);
vertex(200,200,0,tex.width,tex.height);
endShape();
}[/code]

The above code shoudl draw a red-tinted polygon, however it's completely
white. If you uncomment either of the commented out fill() calls, the first
vertex is red coloured , and there is a smooth transition across the
polygon to the other vertex colours.
Additional Comment #1 From fry 2005-10-16 10:16
ah, thanks for tracking this down.. there was a problem with the coloring
but i couldn't find it in the renderer, but this makes it clear where it's
happening. i'll try to get a fix in there asap.
Additional Comment #2 From ewjordan 2007-05-05 17:11
I know this is an old bug, but it still seems to be active in 0124. I
think I tracked down the problem more specifically - there's no textured
analogue to the drawsegment_plain or drawsegment_plain_alpha functions in
PTriangle.java, only gouraud shaded ones, which means that colored+textured
polygons for some reason falling through to the plain texture renderer or
the textured plus alpha one. I think this is also the cause of bug 90,
where tint is doing nothing.

The fix is either to create drawsegment_colored_textureXX versions of each
texturing code, or simply set the gouraud flag (a bit less efficient, but
less code bloat) up inside setIntensities if there is any coloring set at all.
Additional Comment #3 From fry 2007-05-06 15:41
yeah, this is related to the other color/texture stuff that's going wrong
with tint and texture. basically just need to sit down and make it work
consistently across both P3D and OPENGL.

the correct behavior is that:

+ fill() should be ignored when texturing is in use
+ tint() should affect the color of the texture (glColor affects textures),
because textures qualify as images as far as processing is concerned.

so i think in fact that the methods are in PTriangle, however they're not
being mapped properly when fill or tint are in use. and then opengl has
another behavior for it which is inconsistent.
Additional Comment #4 From fry 2007-10-22 19:21
fixed for 0132.