几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】how to improve speed in hatch drawing (http://www.dimcax.com/hust/showthread.php?t=16714)

yang686526 2009-05-06 02:53 PM

【转帖】how to improve speed in hatch drawing
 
how to improve speed in hatch drawing?
how to improve speed in hatch drawing?
hi all,
i want to draw hatch in my own context using opengl.
but when the number of hatch is large or the hatch pattern is dense, the frame rate is very low.
here is my method in brief:
1, in the 1st frame:
a: get the boundingbox(2d, left, right, bottom, top)from the hatch's
boundary.
b: break hatch's boundary into a series of triangles
(if there is any curve in boundary i just break it into line segments first)
c: store the thriangles and the boundingbox for other frame's use.
2, in other frame:
a, get the triangles stored in 1st frame.
set stencil buffer options.
draw these triangles to the stencil buffer
b, get the boundingbox store in 1st frame
set stencil buffer options
for (double x=left; x<right; x+=offestx)
for (double y=bottom; y<top; y+=offesty)
{
draw a series of lines according to hatch's patternname;
}
// in some cases the bounding box is expanded for not using clip
// algorithm, e.g. when the pattern name is ansi31.
i don't know if i express clearly.(sorry for my poor english.)
how to improve the frame rate, can anyone give me some ideas?
or can anyone tell me the method in dwgdirect or autocad in drawing
hatch?
thanks in advacne.
best regards
laoguai0001
last edited by laoguai0001; 6th march 2007 at 12:11 amfff">.


所有的时间均为北京时间。 现在的时间是 02:05 AM.