Notifications
Clear all
[Closed] gw() colors
Apr 07, 2006 3:23 pm
I have a problem where I’m drawing triangles in the viewport using gw calls and the colors are very inconsistent from what I’m setting them to be.
I’m using Larry Minton’s gw.startTriangles(), gw.triangle and gw.endTriangles() because the native gw.polygon and hPolygon/wPolygon respectively don’t seem to do anything at all.
I’m setting a color array with an alpha value, but the gw calls seeme to completely ignore it. They sometimes render brown, blue, dark red, etc. However, gw.polyline colors work as expected.
I’m using DirectX drivers in Max and am running in Max7. Has anyone else run into these problems before?
Here is the code snippet…
fn draw_box bbox_min bbox_max = (
-- Verts
v1 = [bbox_min.x, bbox_min.y, bbox_min.z]
v2 = [bbox_max.x, bbox_min.y, bbox_min.z]
v3 = [bbox_min.x, bbox_max.y, bbox_min.z]
v4 = [bbox_max.x, bbox_max.y, bbox_min.z]
v5 = [bbox_min.x, bbox_min.y, bbox_max.z]
v6 = [bbox_max.x, bbox_min.y, bbox_max.z]
v7 = [bbox_min.x, bbox_max.y, bbox_max.z]
v8 = [bbox_max.x, bbox_max.y, bbox_max.z]
-- Faces
top_1 = #(v5, v8, v7)
top_2 = #(v5, v6, v8)
bottom_1 = #(v1, v3, v4)
bottom_2 = #(v1, v4, v2)
front_1 = #(v1, v6, v5)
front_2 = #(v1, v2, v6)
back_1 = #(v4, v7, v8)
back_2 = #(v4, v3, v7)
left_1 = #(v3, v5, v7)
left_2 = #(v3, v1, v5)
right_1 = #(v2, v8, v6)
right_2 = #(v2, v4, v8)
faces = #(top_1, top_2, bottom_1, bottom_2, front_1, front_2, back_1, back_2, left_1, left_2, right_1, right_2)
clr = (color 255 0 0 128)
clr_array = #(clr, clr, clr)
gw.setRndLimits #(#illum, #zBuffer)
gw.setTransform (Matrix3 1)
gw.startTriangles()
for f in faces do (
gw.triangle f clr_array
)
gw.endTriangles()
)