Bug report: Dynamic Texture bug

Creating scripts
Post Reply
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Bug report: Dynamic Texture bug

Post 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 8315 times
Last edited by Mike Lorrey on Sun Jan 27, 2019 9:57 pm, edited 1 time in total.
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Bug report: Dynamic Texture bug

Post by John Mela »

What is the Alpha Mode setting on that surface?
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Re: Bug report: Dynamic Texture bug

Post by Mike Lorrey »

John Hopkin wrote:
Sun Jan 13, 2019 4:54 am
What is the Alpha Mode setting on that surface?
Alpha blending.
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Re: Bug report: Dynamic Texture bug

Post 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.
These users thanked the author Mike Lorrey for the post (total 2):
Ilan TochnerSue Caxton
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Bug report: Dynamic Texture bug

Post 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.
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Re: Bug report: Dynamic Texture bug

Post 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.
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Bug report: Dynamic Texture bug

Post 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.
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Bug report: Dynamic Texture bug

Post 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.
Post Reply