PDA

View Full Version : Color in TextureMap incorrect ?



Nightmare_82
23-09-2004, 10:19 AM
I updated my engine with the new asphyre components. All works fine except the color using the TextureMap function.
When I use $FF000000 it should be black but it is alwayy the normal color.
Is this a bug or does the color work different form the last version ?

LP
23-09-2004, 09:47 PM
What effect do you use? Remember that to use the diffuse color you should use "effectDiffuse" in addition to any other effects. And if you already do this, what value do you pass to TextureMap function? And do you use use the latest release?

Nightmare_82
23-09-2004, 10:59 PM
I use the latest release. i want to draw a shadow of the items in my level.
I use cColor1($FF000000) and effectSrcAlpha.
With powerDraw3 this worked but with the new version it is always drawn without changing the color.
Only alpha value of the color has an effect.
here is the main part of my drawing method:

procedure TMCDirectXEngine.drawImage(p_iX, p_iY, p_iImageIndex, p_iPatternIndex : integer; p_bAlpha : boolean; p_bFlip : boolean; p_iAngle : integer; p_iScale : integer; p_iColor : Cardinal; p_bAdd : boolean; p_bMirror : Boolean);
var
oImage: TAsphyreImage;
oPos: TPoint4;
iEffect: integer;
begin
// ...
if p_iAngle <> 0 then
oPos := pRotate4c(p_iX, p_iY, oImage.PatternWidth, oImage.PatternHeight, p_iAngle)
else
oPos := pBounds4(p_iX, p_iY, oImage.PatternWidth, oImage.PatternHeight);

if p_iScale <> 0 then
if p_iAngle<> 0 then
oPos:= pRotate4sc(p_iX, p_iY, oImage.PatternWidth, oImage.PatternHeight, p_iAngle, p_iScale)
else
oPos := pBounds4s(p_iX, p_iY, oImage.PatternWidth, oImage.PatternHeight, p_iScale);

iEffect := effectNone;

if (p_bAlpha) then
iEffect := iEffect or effectSrcAlpha;

if (p_bAdd) then
begin
iEffect := iEffect or effectDiffuse or effectSrcAlpha;
end;
m_oPowerDraw.Device.TextureMap(oImage, oPos, cColor1(p_iColor), tPatternEx(p_iPatternIndex, p_bMirror, p_bFlip), iEffect);
end;

LP
24-09-2004, 09:12 PM
Greetings! It's seems very odd and if the color is left unchanged, does this have the same effects on fonts and everything else? (if it's a problem in Asphyre, then all fonts should appear in white color only). Does the same problem occur if you use Software Renderer? Although I possess newer version that the one released - I couldn't reproduce this artifact - diffuse color works as it should. If you still believe the problem is in Asphyre, then please give more detailed info on the image format you using, display mode, etc... and an example would be nice!
Thanks,
Lifepower

snorga
25-09-2004, 09:58 PM
I have spotted this as well. I the newest version (asphyre-pre.exe), it no longer uses the color unless effectDiffuse used.

in the asphyre_exp2.exe version i could just use
TextureMap( . , . ,cColor1($FF00FF00), . ,effectSrcAlpha);

and now i have to use
TextureMap( . , . ,cColor1($FF00FF00), . ,effectSrcAlpha or effectDiffuse);
to get the color applied

LP
26-09-2004, 05:17 PM
This was probably a bug in previous versions which was corrected. In previous versions the diffuse color was ALWAYS used, no matter what, even though it was assumed that you had to specify "effectDiffuse" in order to use the diffuse color. I found this bug recently and now you effectively need to use effectDiffuse parameter.

Nightmare_82
26-09-2004, 08:27 PM
Thanx, with effectDiffuse it works fine.