Page 1 of 1

Bug report: Dynamic Texture bug

Posted: Sun Jan 13, 2019 12:30 am
by Mike Lorrey
osSetPenColor as documented allows us to set pen color by a hexadecimal value that includes a two character value for the transparency preceding the six digit hex color value. So 00 = transparent and FF = opaque, such that 00000000 is transparent black and FF000000 is opaque black. However this not the result inworld. The following script code:

string CommandList = ""; // Storage for our drawing commands

CommandList = osSetPenSize( CommandList, 1 ); // Set the pen width to 3 pixels
CommandList = osSetPenColor( CommandList, "00000000" ); // Set the pen color to transparent black
CommandList = osMovePen( CommandList, 0, 0 ); // Upper left corner at <28,78>
CommandList = osDrawFilledRectangle( CommandList, 256, 256 ); // 256x256 pixels
CommandList = osMovePen( CommandList,10,15);
CommandList = osSetPenColor(CommandList, "Red");
CommandList = osSetFontName(CommandList, "Impact");
CommandList = osSetFontSize(CommandList,80);
CommandList = osDrawText(CommandList,SLTclock);
CommandList = osMovePen(CommandList,15,140);
CommandList = osSetFontSize(CommandList,45);
CommandList = osDrawText(CommandList,"GRIDTIME");

// Now draw the rectangle
osSetDynamicTextureDataBlendFace("", "vector", CommandList, "width:256,height:256",FALSE, 2, 0, 255, 0);

Results in an opaque background to the dynamic texture as seen here on the left compared to the one on the right that has a black background that is opaque.
bull and bear_025.png
bull and bear_025.png (238.29 KiB) Viewed 8379 times

Re: Bug report: Dynamic Texture bug

Posted: Sun Jan 13, 2019 4:54 am
by John Mela
What is the Alpha Mode setting on that surface?

Re: Bug report: Dynamic Texture bug

Posted: Tue Jan 15, 2019 11:37 pm
by Mike Lorrey
John Hopkin wrote:
Sun Jan 13, 2019 4:54 am
What is the Alpha Mode setting on that surface?
Alpha blending.

Re: Bug report: Dynamic Texture bug

Posted: Mon Jan 28, 2019 2:43 pm
by Mike Lorrey
ok found a solution. There's two bugs in the dynamic texture functions wrt alphas. Firstly, they won't do complete transparency, you have to have a value of at least 01 for the functions to execute properly.

Secondly, in addition to specifying the alpha in the osSetPenColor function,
in the osSetDynamicTextureDataBlendFace("", "vector", CommandList, "width:256,height:256",FALSE, 2, 0, 255, 0);
you need to add an alpha spec to the dimensions modifiers, so "width:256,height:256,alpha:01"

Unfortunately, the opensim wiki is not well written and does not mention either of these caveats. There have been some mantis issues that have better explained why you need both alpha specs in the two separate functions.

Re: Bug report: Dynamic Texture bug

Posted: Mon Jan 28, 2019 3:22 pm
by John Mela
Mike, you have 255 for the alpha parameter in osSetDynamicTextureDataBlendFace. Our existing code (which works fine) uses 0 for that parameter, and "alpha:0" in extraParams.

Re: Bug report: Dynamic Texture bug

Posted: Tue Jan 29, 2019 4:21 am
by Mike Lorrey
John Hopkin wrote:
Mon Jan 28, 2019 3:22 pm
Mike, you have 255 for the alpha parameter in osSetDynamicTextureDataBlendFace. Our existing code (which works fine) uses 0 for that parameter, and "alpha:0" in extraParams.
Hi John, I already tried making that parameter 00, and, like setting zero on osPenColor alpha, and in the extraParams, it makes the function break. Unless you have 01 in the pen color alpha and 01 in the extraparams, or higher, you won't get any alpha. Zero value breaks the function, at least here in Kitely. I don't need to make the alpha parameter in osSDTDBF anything for this to work right, so its clear that this function is broken several ways.

Re: Bug report: Dynamic Texture bug

Posted: Tue Jan 29, 2019 1:40 pm
by John Mela
Have you tried using 0 instead of 255 for the alpha parameter in the function call (the penultimate parameter, before face)?

Here's the call I've been using - extraparams contains "alpha:0" (not "00", if that makes a difference):

Code: Select all

osSetDynamicTextureDataBlendFace("", "vector", commands, extraparams, FALSE, 2, 0, 0, face);
This works fine in Kitely and in vanilla OpenSim 0.8.

Re: Bug report: Dynamic Texture bug

Posted: Tue Jan 29, 2019 2:09 pm
by John Mela
Something else I noticed that's different between your and my code - I'm using 00FFFFFF for the background pen colour. That might be worth a try if the 0 alpha parameter doesn't help.