drawPolygon used in gui
by David Massey · in Torque 3D Professional · 08/12/2011 (9:24 am) · 3 replies
Hey folks.. having some trouble getting the right transform for drawing polygon shapes in the gui...
in the following code snippet... the points render correctly if i use drawRectFill.. but not if passed into drawPolygon as shown... i'm sure its got to do with 2D to 3D.. but i've tried a ton of different settings ... changed the Z from 0 to positives, to negatives.. pushed/poped id matrix... not sure what to do...
In short.. i need drawPolygon to render the same points on the screen as drawRectFill...
Vector<Point3F> points;
points.push_back( Point3F(p1.x, p1.y, 10) );
points.push_back( Point3F(p2.x, p2.y, 10) );
points.push_back( Point3F(p3.x, p3.y, 10) );
points.push_back( Point3F(p4.x, p4.y, 10) );
points.push_back( Point3F(p1.x, p1.y, 10) );
ColorF color(red,green,blue);
GFX->getDrawUtil()->drawPolygon( desc, points.address(), points.size(), color );
RectI r;
r.set(p1.x,p1.y,1,1);
GFX->getDrawUtil()->drawRectFill(r, mDamageFillColor);
in the following code snippet... the points render correctly if i use drawRectFill.. but not if passed into drawPolygon as shown... i'm sure its got to do with 2D to 3D.. but i've tried a ton of different settings ... changed the Z from 0 to positives, to negatives.. pushed/poped id matrix... not sure what to do...
In short.. i need drawPolygon to render the same points on the screen as drawRectFill...
Vector<Point3F> points;
points.push_back( Point3F(p1.x, p1.y, 10) );
points.push_back( Point3F(p2.x, p2.y, 10) );
points.push_back( Point3F(p3.x, p3.y, 10) );
points.push_back( Point3F(p4.x, p4.y, 10) );
points.push_back( Point3F(p1.x, p1.y, 10) );
ColorF color(red,green,blue);
GFX->getDrawUtil()->drawPolygon( desc, points.address(), points.size(), color );
RectI r;
r.set(p1.x,p1.y,1,1);
GFX->getDrawUtil()->drawRectFill(r, mDamageFillColor);
Torque Owner David Massey
TimeSync Interactive
fyi - the goal is to make circular progress bars... I have them implemented using drawRectFill on the points - but they are (of course) blocky... If I can get the drawPoly to work in 2d space.. I can feed in the poitns for a smooth circle...
Anyone have other ideas for circular progress bars? ( not using multiple images...)