When I create a box primitive via XML like this:
<primitive name="testBox01" shape_type="BOX" />
I get a nice white boxloaded in the center of the scene that I can manipulate from LUA without issue. For example, I know I can put a texture on it by assigning it a material then applying an existing texture to that material like so:
HYP_Object.SetMaterial( "testBox01", "myMaterial");
HYP_Object.AttachTexture( "testBox01", "myTexture", "myMaterial", 0);
That all seems to work fine. The problem arises when I attempt to create the same primitive totally from LUA. The following code successfully creates a box primitive in the center of the screen, however this box has a rainbow hue and simply ignores requests to change the texture using the technique in the code sample above.
local id = HYP_Primitive.CreateBox("testBox);
I used what data I could gather from the various HYP_Object.Get... functions to compare the data between the two boxes. It seems like two methods (XML vs. Lua) create a box with different default values. Of the data i could inspect I found that the default size, texturing state, and blending factors are different. I attempted to correct for this in the Lua box by using HYP_Object.Set functions to correct the texturing state and blending factors but this was either ignored by the Lua box or not really the problem.
What am I missing here? Is there some way for me to create a box (or other primitive) in Lua so that I can subsequently alter the texture? I assume it's a bug that the defaults vary between the two methods but perhaps it's not. Any information I can get on this would be very much appreciated.