Game Development Community

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);

#1
08/17/2011 (9:59 am)
Still trying to solve this.. no one has any ideas?

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...)

#2
08/17/2011 (3:12 pm)
sometimes... your code can just make you just feel stupid...
drawPolygon works easy-peasy.. the problem was elsewhere...
#3
08/19/2011 (11:13 am)
We have all been there :D