<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-36878330</id><updated>2011-07-28T21:50:48.095-07:00</updated><title type='text'>Whorld</title><subtitle type='html'>Development notes for the &lt;a href="http://whorld.org"&gt;Whorld&lt;/a&gt; geometric visualizer/VJ software/Freeframe plugin.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>78</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-36878330.post-3882691102790537803</id><published>2009-08-15T14:20:00.000-07:00</published><updated>2010-01-06T14:20:38.424-08:00</updated><title type='text'>Curve Angle</title><content type='html'>some benchmarks, all in microseconds, 100 rings, running average of 100 samples:&lt;br /&gt;&lt;br /&gt;574 previous version: no curve angle support&lt;br /&gt;765 curve angle support, but curve angle2 calc commented out&lt;br /&gt;767 curve angle support, but curve angle2 calc skipped by zero test&lt;br /&gt;&lt;br /&gt;same test but with 20 sides instead of 5:&lt;br /&gt;1.843 previous version: no curve angle support&lt;br /&gt;2.547 curve angle support, but curve angle2 calc commented out&lt;br /&gt;2.564 curve angle support, but curve angle2 calc skipped by zero test&lt;br /&gt;&lt;br /&gt;same test on bad box:&lt;br /&gt;297 previous version: no curve angle support&lt;br /&gt;378 curve angle support, but curve angle2 calc skipped by zero test&lt;br /&gt;&lt;br /&gt;Either way best case is curve calc now takes approx. 33% longer. However the good news is the entire point calc is only about 20% of the draw function time *in line mode*.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-3882691102790537803?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/3882691102790537803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=3882691102790537803' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/3882691102790537803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/3882691102790537803'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2009/08/curve-angle.html' title='Curve Angle'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-3049385511895125545</id><published>2009-07-14T14:18:00.000-07:00</published><updated>2010-01-06T14:19:59.163-08:00</updated><title type='text'>Whorld Choir</title><content type='html'>According to my calculations, the plasmagon patch would take almost 6 million years to return to its starting position, and that's not counting the pinwheel global oscillator. Yikes! I guess I can see why there's no such thing as LCM for real numbers but it bothers me somehow.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;0.03 33.33333333&lt;br /&gt;0.07 14.28571429&lt;br /&gt;0.08 12.5&lt;br /&gt;0.09 11.11111111&lt;br /&gt;0.003 333.3333333&lt;br /&gt;0.004 250&lt;br /&gt;0.005 200&lt;br /&gt;0.006 166.6666667&lt;br /&gt; 1.83715E+14 seconds&lt;br /&gt; 5825579.068 years&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-3049385511895125545?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/3049385511895125545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=3049385511895125545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/3049385511895125545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/3049385511895125545'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2009/07/whorld-choir.html' title='Whorld Choir'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-4909492788324097784</id><published>2008-04-05T22:28:00.001-07:00</published><updated>2008-04-05T22:28:35.152-07:00</updated><title type='text'>Whorld/GL: only the beginning</title><content type='html'>It seems that Whorld's drawing code can't be directly ported to OpenGL, because OpenGL doesn't even handle concave polygons, never mind self-overlapping polygons or shapes composed of Bezier curves. The good news is, it might be possible to use a combination of GDI and OpenGL. GDI provides a function called FlattenPath, which turns a path containing Bezier curves into a (very large) set of line segments. This flattened path could then be passed to the glu tessellation functions, which would turn the path into a set of simple polygons that could be rendered directly in OpenGL. It all sounds a bit Rube Goldberg, but it might be worth it to achieve transparency and the many other effects available in OpenGL. The GDI FlattenPath function seems to be very fast, at least compared to the actual rendering done by StrokeAndFillPath.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-4909492788324097784?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/4909492788324097784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=4909492788324097784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/4909492788324097784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/4909492788324097784'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2008/04/whorldgl-only-beginning.html' title='Whorld/GL: only the beginning'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-4145937256901083916</id><published>2008-02-06T22:16:00.000-08:00</published><updated>2008-04-05T22:17:02.421-07:00</updated><title type='text'>compensating frame rate</title><content type='html'>If you change the frame rate, and want your patches to look the same, you must compensate the following variables: Ring Growth, and Color Speed. If you double the frame rate, halve Ring Growth and Color Speed. Yes, the app should take care of this for you, but for the moment it doesn't.&lt;br /&gt;&lt;br /&gt;Patches that depend on a particular relationship to the frame rate (e.g. the Seed of Life patch) will require further tweaking.&lt;br /&gt;&lt;br /&gt;Note that changing the frame rate will change the relative speed of the cascading delete, and there's currently no way to compensate for it. Sorry!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-4145937256901083916?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/4145937256901083916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=4145937256901083916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/4145937256901083916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/4145937256901083916'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2008/02/compensating-frame-rate.html' title='compensating frame rate'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-3222756867774565930</id><published>2008-01-26T22:15:00.000-08:00</published><updated>2008-04-05T22:16:34.348-07:00</updated><title type='text'>bezier benchmarks (categorized)</title><content type='html'>frames = 500&lt;br /&gt;playlist: new curve alg bench.whl&lt;br /&gt;patch: default&lt;br /&gt;Master Offsets:&lt;br /&gt;Star Factor = 1&lt;br /&gt;Even Curve = .2&lt;br /&gt;Odd Curve = .2&lt;br /&gt;draw mode = line (or fill/outline)&lt;br /&gt;NOTE: app should be MAXIMIZED at 1024 x 768&lt;br /&gt;&lt;br /&gt;Dell / W2K&lt;br /&gt;draw mode: lines only&lt;br /&gt;back buffer: auto (video memory)&lt;br /&gt;OnTimer = 0.054 (0.29%)&lt;br /&gt;Draw = 18.992 (99.71%)&lt;br /&gt; math = 0.600 (3.15%)&lt;br /&gt; GDI = 18.393 (96.57%)&lt;br /&gt;total = 19.047&lt;br /&gt;secs@frame = 0.38 (26.25 FPS)&lt;br /&gt;2nd pass: similar&lt;br /&gt;&lt;br /&gt;Bad Box / XP&lt;br /&gt;draw mode: lines only&lt;br /&gt;back buffer: auto (video memory)&lt;br /&gt;OnTimer = 0.008 (0.16%)&lt;br /&gt;Draw = 4.854 (99.84%)&lt;br /&gt; math = 0.263 (5.41%)&lt;br /&gt; GDI = 4.590 (94.42%)&lt;br /&gt;total = 4.862&lt;br /&gt;secs@frame = 0.010 (102.84 FPS)&lt;br /&gt;&lt;br /&gt;Bad Box / XP&lt;br /&gt;draw mode: fill/outline&lt;br /&gt;back buffer: auto (video memory)&lt;br /&gt;OnTimer = 0.008 (0.05%)&lt;br /&gt;Draw = 16.735 (99.95%)&lt;br /&gt; math = 0.270 (1.61%)&lt;br /&gt; GDI = 16.466 (98.34%)&lt;br /&gt;total = 16.744&lt;br /&gt;secs@frame = 0.033 (29.86 FPS)&lt;br /&gt;2nd pass: similar&lt;br /&gt;not too good!&lt;br /&gt;&lt;br /&gt;Bad Box / XP&lt;br /&gt;draw mode: fill/outline&lt;br /&gt;back buffer: system memory&lt;br /&gt;OnTimer = 0.016 (0.09%)&lt;br /&gt;Draw = 17.916 (99.91%)&lt;br /&gt; math = 0.276 (1.54%)&lt;br /&gt; GDI = 17.639 (98.37%)&lt;br /&gt;total = 17.931&lt;br /&gt;secs@frame = 0.036 (27.88 FPS)&lt;br /&gt;2nd pass: similar&lt;br /&gt;system memory is not helping&lt;br /&gt;&lt;br /&gt;Z Dell / XP&lt;br /&gt;FPS: 25&lt;br /&gt;draw mode: fill/outline&lt;br /&gt;back buffer: auto (video memory)&lt;br /&gt;OnTimer = 0.014 (0.06%)&lt;br /&gt;Draw = 21.519 (99.94%)&lt;br /&gt;math = 0.145 (0.67%)&lt;br /&gt;GDI = 21.374 (99.26%)&lt;br /&gt;total = 21.533&lt;br /&gt;secs@frame = 0.043 (23.22 FPS)&lt;br /&gt;7 FPS *SLOWER* than Bad Box with back buffer in video memory? just terrible&lt;br /&gt;&lt;br /&gt;Z Dell / XP&lt;br /&gt;FPS: 25&lt;br /&gt;draw mode: fill/outline&lt;br /&gt;back buffer: system memory&lt;br /&gt;OnTimer = 0.017 (0.12%)&lt;br /&gt;Draw = 14.446 (99.98%)&lt;br /&gt;math = 0.146 (1.01%)&lt;br /&gt;GDI = 14.300 (98.88%)&lt;br /&gt;total = 14.463&lt;br /&gt;secs@frame = 0.029 (34.57 FPS)&lt;br /&gt;brand-new 2.66 GHz Dell is maximum 5 FPS faster than 3-year old Bad Box?&lt;br /&gt;system memory *is* helping in this case, WTF?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-3222756867774565930?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/3222756867774565930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=3222756867774565930' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/3222756867774565930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/3222756867774565930'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2008/01/bezier-benchmarks-categorized.html' title='bezier benchmarks (categorized)'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-5953653465561116807</id><published>2008-01-25T22:12:00.000-08:00</published><updated>2008-04-05T22:15:19.509-07:00</updated><title type='text'>benchmarks for improved curve generation</title><content type='html'>In previous versions, curves were unstable (i.e. they would jitter) when star factor was negative. This occurred because the curve points were being computed from integer vertices. The new version computes the curve points from real vertices. Also, the curves points are now generated at the same time as the vertices, in a single loop, instead of in a second pass. This is more efficient, and eliminates the need for a second point array.&lt;br /&gt;&lt;br /&gt;Comparing 1.6.06 and 1.7.03&lt;br /&gt;&lt;br /&gt;Only the math portion of Draw is compared.&lt;br /&gt;&lt;br /&gt;playlist: new curve alg bench.whl&lt;br /&gt;patch: default&lt;br /&gt;Master Offsets:&lt;br /&gt;Star Factor = 1&lt;br /&gt;Even Curve = .2&lt;br /&gt;Odd Curve = .2&lt;br /&gt;&lt;br /&gt;Benchmark includes code between&lt;br /&gt; while (NextPos != NULL) {&lt;br /&gt;and&lt;br /&gt; rp.Delete = !RingVisible;&lt;br /&gt;plus MakeCurves in 1.6.06&lt;br /&gt;&lt;br /&gt;1000 frames&lt;br /&gt;&lt;br /&gt;pass 1.6.06  1.7.03&lt;br /&gt;---- -------  -------&lt;br /&gt;#1 .001157  .000998&lt;br /&gt;#2 .001161  .000995  (14% faster)&lt;br /&gt;&lt;br /&gt;In summary, the Draw math takes less time in 1.7.03, despite having added some major new features (global parameters, curve shear). Presumably the speedup is due to a combination of better-optimized code and reduced memory usage. The global parameters aren't free, but their cost is minimal: 1.7.03 drops to around .000930 if m_GlobRing is removed from Draw.&lt;br /&gt;&lt;br /&gt;Total time for Draw in 1.7.03: .025 in line mode, off the chart in fill mode&lt;br /&gt;&lt;br /&gt;Same exact tests, but on the bad box:&lt;br /&gt;&lt;br /&gt;pass 1.6.06  1.7.03&lt;br /&gt;---- -------  -------&lt;br /&gt;#1 .000654  .000468&lt;br /&gt;#2 .000653  .000468  (28% faster)&lt;br /&gt;&lt;br /&gt;Total time for Draw: .009 in line mode, .022 in fill mode&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-5953653465561116807?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/5953653465561116807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=5953653465561116807' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/5953653465561116807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/5953653465561116807'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2008/01/benchmarks-for-improved-curve.html' title='benchmarks for improved curve generation'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228490821283116</id><published>2006-06-19T00:54:00.000-07:00</published><updated>2006-10-31T02:59:47.480-08:00</updated><title type='text'>swarm</title><content type='html'>in AddRing:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int     swcnt;  // number of vertices in swarm polygon&lt;br /&gt;int     swidx;  // index of swarm polygon's current vertex&lt;br /&gt;int     swrad;  // radius of swarm polygon, in pixels&lt;br /&gt;&lt;br /&gt;double  theta = (PI * 2) * (double(swidx) / swcnt);     // can be better optimized&lt;br /&gt;Ring.Shift.x += sin(theta) * swrad;&lt;br /&gt;Ring.Shift.y += cos(theta) * swrad;&lt;br /&gt;swidx++;&lt;br /&gt;swidx %= swcnt;         // can be better optimized&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;NOTE that this feature requires the skew curve fix (see above), otherwise curves will be horribly distorted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228490821283116?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228490821283116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228490821283116' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228490821283116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228490821283116'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/06/swarm.html' title='swarm'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228485379534798</id><published>2006-06-19T00:53:00.000-07:00</published><updated>2006-10-31T01:31:40.033-08:00</updated><title type='text'>skew curve fix</title><content type='html'>Skew distorts curved rings; to avoid this, MakeCurves must use the skewed origin.&lt;br /&gt;&lt;br /&gt;wrong:&lt;br /&gt;iorg = CPoint(round(org.x), round(org.y));&lt;br /&gt;&lt;br /&gt;correct:&lt;br /&gt;iorg = CPoint(round(xshift), round(yshift));&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228485379534798?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228485379534798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228485379534798' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228485379534798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228485379534798'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/06/skew-curve-fix.html' title='skew curve fix'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228482796538713</id><published>2006-06-05T00:53:00.000-07:00</published><updated>2006-10-31T01:38:55.946-08:00</updated><title type='text'>maximize list control within playlist dialog</title><content type='html'>&lt;pre&gt;&lt;br /&gt;void CPlaylistDlg::OnHideControls() &lt;br /&gt;{&lt;br /&gt;        m_HideControls ^= 1;&lt;br /&gt;        CWnd    *wp = GetWindow(GW_CHILD);&lt;br /&gt;        while (wp != NULL) {&lt;br /&gt;                if (wp != &amp;m_List)&lt;br /&gt;                        wp-&gt;ShowWindow(m_HideControls ? SW_HIDE : SW_SHOW);&lt;br /&gt;                wp = wp-&gt;GetNextWindow();&lt;br /&gt;        }&lt;br /&gt;        PostMessage(WM_SIZE);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CPlaylistDlg::OnSize(UINT nType, int cx, int cy) &lt;br /&gt;{&lt;br /&gt;        CToolDlg::OnSize(nType, cx, cy);&lt;br /&gt;        if (m_HideControls) {&lt;br /&gt;                CRect   r;&lt;br /&gt;                GetClientRect(r);&lt;br /&gt;                m_List.MoveWindow(r);&lt;br /&gt;        } else&lt;br /&gt;                m_Resize.OnSize();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CPlaylistDlg::OnShowWindow(BOOL bShow, UINT nStatus) &lt;br /&gt;{&lt;br /&gt;        CToolDlg::OnShowWindow(bShow, nStatus);&lt;br /&gt;        if (bShow &amp;&amp; !m_HideControls)&lt;br /&gt;                m_Resize.OnSize();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228482796538713?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228482796538713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228482796538713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228482796538713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228482796538713'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/06/maximize-list-control-within-playlist.html' title='maximize list control within playlist dialog'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228479627595965</id><published>2006-06-02T00:52:00.000-07:00</published><updated>2006-10-31T01:39:10.070-08:00</updated><title type='text'>MIDI support for video functions</title><content type='html'>Assuming MIDI ranges equal 5 (the default):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Video Select&lt;br /&gt;&lt;br /&gt;num     MIDI    Video&lt;br /&gt;pad     Values  Clip&lt;br /&gt;0       0..12   0&lt;br /&gt;1       13..25  1&lt;br /&gt;2       26..38  2&lt;br /&gt;3       39..51  3&lt;br /&gt;4       52..63  4&lt;br /&gt;5       64..76  5&lt;br /&gt;6       77..89  6&lt;br /&gt;7       90..101 7&lt;br /&gt;8       102..114        8&lt;br /&gt;9       115..126        9&lt;br /&gt;.       127     None&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that a value of 127 disables video. If this is undesirable, set Video Select's MIDI range to 4.99 instead of 5.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Video Blending &lt;br /&gt;&lt;br /&gt;num     MIDI    &lt;br /&gt;pad     Values  Blending        description     ROP code        GDI name&lt;br /&gt;0       0..12   ~Src &amp; Dst      AND inverted source with destination    DSna    &lt;br /&gt;1       13..25  ~Src | Dst      OR inverted source with destination     DSno    MERGEPAINT&lt;br /&gt;2       26..38  Src &amp; ~Dst      AND source with inverted destination    SDna    SRCERASE&lt;br /&gt;3       39..51  Src &amp; ~Dst      OR source with inverted destination     SDno            &lt;br /&gt;4       52..63  Src &amp; Dst       AND source with destination     DSa     SRCAND&lt;br /&gt;5       64..76  Src | Dst       OR source with destination      DSo     SRCPAINT&lt;br /&gt;6       77..89  Src ^ Dst       XOR source with destination     DSx     SRCINVERT&lt;br /&gt;7       90..101 ~(Src &amp; Dst)    AND source with destination, invert result      DSan            &lt;br /&gt;8       102..114        ~(Src | Dst)    OR source with destination, invert result       DSon    NOTSRCERASE&lt;br /&gt;9       115..127        ~(Src ^ Dst)    XOR source with destination, invert result      DSxn            &lt;br /&gt;&lt;br /&gt;Video Cycle Length&lt;br /&gt;&lt;br /&gt;num     MIDI    Cycle&lt;br /&gt;pad     Values  Length&lt;br /&gt;1       0..12   1&lt;br /&gt;2       13..25  2&lt;br /&gt;3       26..38  3&lt;br /&gt;4       39..51  4&lt;br /&gt;5       52..63  5&lt;br /&gt;6       64..76  6&lt;br /&gt;7       77..89  7&lt;br /&gt;8       90..101 8&lt;br /&gt;9       102..114        9&lt;br /&gt;0       115..127        10&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that numpad zero sets the cycle length to "all" which is effectively 10.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228479627595965?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228479627595965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228479627595965' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228479627595965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228479627595965'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/06/midi-support-for-video-functions.html' title='MIDI support for video functions'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228463747964467</id><published>2006-05-16T00:49:00.000-07:00</published><updated>2006-10-31T01:39:27.826-08:00</updated><title type='text'>pre-fetching video</title><content type='html'>&lt;pre&gt;&lt;br /&gt;bool CPlaylistDlg::PreFetchVideo()&lt;br /&gt;{&lt;br /&gt;    CAviToBmp   vid;&lt;br /&gt;    for (int i = 0; i &lt; BANKS; i++) {&lt;br /&gt;        int count = m_Bank[i].GetSize();&lt;br /&gt;        for (int j = 0; j &lt; count; j++) {&lt;br /&gt;            LPCSTR  Path = m_Bank[i][j].m_Path;&lt;br /&gt;            if (IsVideo(Path)) {&lt;br /&gt;                if (!vid.Open(Path))&lt;br /&gt;                    return(FALSE);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return(TRUE);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This takes approx. 10 seconds for all 340 clips. We can't pre-open the clips because AVIStreamGetFrameOpen won't open more than 75 AVI files simultaneously (it fails with no error message). Not sure why just opening and closing the clips helps. Something to do with disk caching? Not sure how *much* it helps either.&lt;br /&gt;&lt;br /&gt;The 10 second delay can be avoided by doing the pre-fetch in a background thread. Note the CoInitialize! AviFileOpen fails without it. This gives me a bad feeling that VfW isn't thread-safe...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;UINT CPlaylistDlg::PreFetchVideoThread(LPVOID pParam)&lt;br /&gt;{&lt;br /&gt;    CoInitialize(0);&lt;br /&gt;    CPlaylistDlg    *pd = (CPlaylistDlg *)pParam;&lt;br /&gt;    if (!pd-&gt;PreFetchVideo())&lt;br /&gt;        AfxMessageBox("Can't pre-fetch video");&lt;br /&gt;    CoUninitialize();&lt;br /&gt;    return(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;in CPlaylistDlg::Cache:&lt;br /&gt;AfxBeginThread(PreFetchVideoThread, this, &lt;br /&gt;    THREAD_PRIORITY_BELOW_NORMAL, 0, 0, 0);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The 75 clip limit is apparently NOT due to XVID, it occurs with Cinepack too.&lt;br /&gt;&lt;br /&gt;Test to determine how much of Open delay is due to AVIStreamGetFrameOpen. Result for 100 Opens:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;        total   avg     min     max&lt;br /&gt;Open    4.915   .049    .007    .087&lt;br /&gt;GetFr.  0.790   .008    .007    .009&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;A second run gave very similar results:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Open    3.119   .031    .007    .087&lt;br /&gt;GetFr.  0.741   .007    .007    .009&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Result: AVIStreamGetFrameOpen is less than 15% of the average, but more importantly, it has a static cost of ~8 milliseconds. This makes a reasonable case for trying the partial pre-open strategy (pre-open all clips but without doing AVIStreamGetFrameOpen, and then do AVIStreamGetFrameOpen when the clip is selected).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228463747964467?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228463747964467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228463747964467' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228463747964467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228463747964467'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/05/pre-fetching-video.html' title='pre-fetching video'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228454122267302</id><published>2006-05-10T00:48:00.001-07:00</published><updated>2006-10-31T01:41:55.370-08:00</updated><title type='text'>exporting a looped movie</title><content type='html'>Tried exporting a bidirectional movie (plays forward and then plays in reverse). It's smoother than just letting the video jump back to the beginning but there's still a visible transition when the rings change direction.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int PassFrames = m_RangeLast - m_RangeFirst + 1;&lt;br /&gt;int TotalFrames = (PassFrames - 1) * 2;&lt;br /&gt;pd.Create();&lt;br /&gt;int j = m_RangeLast;&lt;br /&gt;pd.SetRange(0, TotalFrames);&lt;br /&gt;for (int i = 0; i &lt; TotalFrames; i++) {&lt;br /&gt;    if (i &gt;= PassFrames)&lt;br /&gt;        sm.Seek(--j);&lt;br /&gt;    sm.Read();&lt;br /&gt;    HBITMAP bm = View-&gt;MakeDIB(&amp;OutFrameSize, &amp;m_InFrameSize, GetScaleToFit());&lt;br /&gt;    bool    retc = bta.AddFrame(bm);&lt;br /&gt;    DeleteObject(bm);&lt;br /&gt;    if (!m_DisplayOutput)   // prevent view from painting&lt;br /&gt;        View-&gt;ValidateRect(NULL);   // must revalidate before SetPos&lt;br /&gt;    pd.SetPos(i);&lt;br /&gt;    if (pd.Canceled())&lt;br /&gt;        return(IDCANCEL);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228454122267302?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228454122267302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228454122267302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228454122267302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228454122267302'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/05/exporting-looped-movie.html' title='exporting a looped movie'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228450764154265</id><published>2006-05-10T00:48:00.000-07:00</published><updated>2006-10-31T01:39:42.646-08:00</updated><title type='text'>Lissajous</title><content type='html'>Tried it. It's too predictable and hugs the edge of the frame too much. Not so good! The random motion is better.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228450764154265?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228450764154265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228450764154265' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228450764154265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228450764154265'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/05/lissajous.html' title='Lissajous'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228448606943189</id><published>2006-05-09T00:47:00.000-07:00</published><updated>2006-10-31T01:42:08.006-08:00</updated><title type='text'>video mirroring quadrant selection</title><content type='html'>&lt;pre&gt;&lt;br /&gt;CSize   FrmSz(m_Size);&lt;br /&gt;CSize   SrcSz(vp-&gt;GetFrameSize());&lt;br /&gt;CPoint  SrcPt;&lt;br /&gt;if (m_st.Mirror) {&lt;br /&gt;    FrmSz.cx = (FrmSz.cx + 1) &gt;&gt; 1;&lt;br /&gt;    FrmSz.cy = (FrmSz.cy + 1) &gt;&gt; 1;&lt;br /&gt;    switch (Quadrant) {&lt;br /&gt;    case 0: // upper left&lt;br /&gt;        SrcPt = CPoint(0, SrcSz.cy - 1);&lt;br /&gt;        SrcSz.cx &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cy &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cy = -SrcSz.cy;&lt;br /&gt;        break;&lt;br /&gt;    case 1: // upper right&lt;br /&gt;        SrcPt = CPoint(SrcSz.cx - 1, SrcSz.cy - 1);&lt;br /&gt;        SrcSz.cx &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cy &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cx = -SrcSz.cx;&lt;br /&gt;        SrcSz.cy = -SrcSz.cy;&lt;br /&gt;        break;&lt;br /&gt;    case 2: // lower left&lt;br /&gt;        SrcPt = CPoint(0, 0);&lt;br /&gt;        SrcSz.cx &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cy &gt;&gt;= 1;&lt;br /&gt;        break;&lt;br /&gt;    case 3: // lower right&lt;br /&gt;        SrcPt = CPoint(SrcSz.cx - 1, 0);&lt;br /&gt;        SrcSz.cx &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cy &gt;&gt;= 1;&lt;br /&gt;        SrcSz.cx = -SrcSz.cx;&lt;br /&gt;        break;&lt;br /&gt;    }&lt;br /&gt;} else {&lt;br /&gt;    SrcPt = CPoint(0, SrcSz.cy - 1);&lt;br /&gt;    SrcSz.cy = -SrcSz.cy;&lt;br /&gt;}&lt;br /&gt;HDC sdc;&lt;br /&gt;vp-&gt;GetDC(&amp;sdc);&lt;br /&gt;StretchBlt(dc, 0, 0, FrmSz.cx, FrmSz.cy, sdc,&lt;br /&gt;    SrcPt.x, SrcPt.y, SrcSz.cx, SrcSz.cy, m_VideoList.GetROP());&lt;br /&gt;vp-&gt;ReleaseDC(sdc);&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228448606943189?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228448606943189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228448606943189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228448606943189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228448606943189'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/05/video-mirroring-quadrant-selection.html' title='video mirroring quadrant selection'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228444907596223</id><published>2006-04-24T00:46:00.000-07:00</published><updated>2006-10-31T01:42:21.026-08:00</updated><title type='text'>more optimizations</title><content type='html'>In Draw:&lt;br /&gt;replaced CRect::OffsetRect in Bounds calc with inline&lt;br /&gt;replaced CRect::PtInPect in inner loop with inline (BIG difference)&lt;br /&gt;only calculate iorg if making Curves&lt;br /&gt;&lt;br /&gt;benchmarks:&lt;br /&gt;hot rod, 1024 x 768, maximized (but not full screen)&lt;br /&gt;default patch, fill &amp; outline, speed = 20 "curve fill bench.whl"&lt;br /&gt;total Draw time for 1000 frames at 25 FPS, in seconds&lt;br /&gt;average ring count = 193&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;v1.1.01 v1.4.04&lt;br /&gt;---------------&lt;br /&gt;12.643  12.831&lt;br /&gt;12.630  12.641&lt;br /&gt;12.629  12.639&lt;br /&gt;12.629  12.830&lt;br /&gt;12.638  12.651&lt;br /&gt;12.633  12.638&lt;br /&gt;12.637  12.833&lt;br /&gt;12.636  12.645&lt;br /&gt;12.630  12.840&lt;br /&gt;        12.643&lt;br /&gt;        12.633&lt;br /&gt;        12.671&lt;br /&gt;        12.644&lt;br /&gt;        12.639&lt;br /&gt;&lt;br /&gt;AVG     AVG&lt;br /&gt;12.634  12.698&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;1.4.04 has a noticeably larger deviation: most of the samples cluster around 12.64 but every fourth sample or so clusters around 12.83. No idea why! Generally the results are encouraging however. If we go by the averages, 1.4.04 is 64 microseconds slower per frame, which translates to an extra 1.6 milliseconds per second at 25 FPS. If we go by the worst case, 1.4.04 is 210 microseconds slower per frame, i.e. an extra 5.25 milliseconds per second (half a percent). Neither difference is likely to be significant.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Same exact test but without fill (still on hot rod):&lt;br /&gt;v1.1.01 v1.4.04&lt;br /&gt;---------------&lt;br /&gt;0.428   0.413&lt;br /&gt;0.428   0.413&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;For non-fill case, 1.4.04 is FASTER! Awesome. Presumably inlining PtInRect in the innermost loop made the big difference, let's see.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;1.4.04 no fill, using CRect::PtInRect:&lt;br /&gt;        0.447&lt;br /&gt;        0.448&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Yup, CRect::PtInRect was bad stuff. Not sure whether it was the function call or inefficiency within PtInRect itself, or maybe both.&lt;br /&gt;&lt;br /&gt;An interesting question: why is the difference worse with fill/outline? Almost all of the added code gets executed regardless of draw mode. The only exceptions are the Convex test to decide rp.Color vs. PrevColor, and the (Curve || PrevCurve) test. Surely these can't account for 64..210 microseconds per frame?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228444907596223?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228444907596223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228444907596223' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228444907596223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228444907596223'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/more-optimizations.html' title='more optimizations'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228437057817398</id><published>2006-04-24T00:45:00.001-07:00</published><updated>2006-10-31T01:43:04.106-08:00</updated><title type='text'>per-ring curve decision benchmarks</title><content type='html'>Bottom line: The per-ring version (1.4.03) is very slightly faster than 1.4.02. The data shows a consistent improvement of between 5 and 10 microseconds per frame. This is the opposite of the expected result. Perhaps moving the curvature test into the main loop allowed the compiler to better optimize the initial pass (for trail)? It could also be a change in cache behavior.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include "benchmark.h"&lt;br /&gt;float sum;&lt;br /&gt;int cnt;&lt;br /&gt;void CWhorldView::Draw(HDC dc)&lt;br /&gt;{&lt;br /&gt;CBenchmark  b;&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;sum += b.Elapsed();&lt;br /&gt;cnt++;&lt;br /&gt;if (cnt == 1000) {&lt;br /&gt;    CString s;&lt;br /&gt;    s.Format("%d %f %f\n", cnt, sum, sum / cnt);&lt;br /&gt;    AfxMessageBox(s);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;total time (sum) in seconds for 1000 frames&lt;br /&gt;&lt;br /&gt;default patch&lt;br /&gt;1.4.02  1.4.03&lt;br /&gt;--------------&lt;br /&gt;1.448   1.436&lt;br /&gt;1.448   1.436&lt;br /&gt;1.442   1.435&lt;br /&gt;1.442   1.439&lt;br /&gt;1.446   1.440&lt;br /&gt;&lt;br /&gt;default patch, speed and canvas scale at max&lt;br /&gt;1.4.02  1.4.03&lt;br /&gt;--------------&lt;br /&gt;5.400   5.390&lt;br /&gt;5.396   5.390&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228437057817398?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228437057817398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228437057817398' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228437057817398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228437057817398'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/per-ring-curve-decision-benchmarks.html' title='per-ring curve decision benchmarks'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228432978150211</id><published>2006-04-24T00:45:00.000-07:00</published><updated>2006-10-31T01:42:34.073-08:00</updated><title type='text'>help changes for 1.4</title><content type='html'>add Odd Curve and Even Curve to parameters (done)&lt;br /&gt;move Canvas Scale and Hue Loop Length from Options/General to Master (done)&lt;br /&gt;change ReadFromPatch to Patch Mode and expand as needed (done)&lt;br /&gt;update keyboard accelerators (done)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228432978150211?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228432978150211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228432978150211' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228432978150211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228432978150211'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/help-changes-for-14.html' title='help changes for 1.4'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228425704091389</id><published>2006-04-16T00:43:00.000-07:00</published><updated>2006-10-31T01:42:50.020-08:00</updated><title type='text'>using multimedia timer instead of windows timer</title><content type='html'>We can't use a multimedia timer all the time (as was suggested on the MFC forum), because it significantly increases CPU useage, e.g. 75% vs. 33%. Windows task-switching overhead is the most likely culprit, especially since using a custom timer thread instead of a multimedia timer produces identical behavior.&lt;br /&gt;&lt;br /&gt;We could use a multimedia timer only during non-client modal states, but there's still a visible glitch, due to the phase difference between the windows timer and the multimedia timer. The difference varies from 0 to 1 timer periods, and I can't see any obvious way to avoid it. It's better than doing nothing, but it may have other side effects, so the SendMessage technique shown above may still be the best shot.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228425704091389?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228425704091389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228425704091389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228425704091389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228425704091389'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/using-multimedia-timer-instead-of.html' title='using multimedia timer instead of windows timer'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228430596030236</id><published>2006-04-14T00:44:00.000-07:00</published><updated>2006-10-31T01:43:18.393-08:00</updated><title type='text'>corrupt Mirror, Origin, Drawmode in patches</title><content type='html'>The first cases appeared on 10/08/2005. Many of the "frosty" patches had it, and the corrupt data propagated from them to other patches, via hybridization. All patches were fixed today. I can't replicate the behavior nor can I find any obvious cause in the current code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228430596030236?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228430596030236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228430596030236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228430596030236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228430596030236'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/corrupt-mirror-origin-drawmode-in.html' title='corrupt Mirror, Origin, Drawmode in patches'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228428524899098</id><published>2006-04-11T00:44:00.000-07:00</published><updated>2006-10-31T01:43:34.736-08:00</updated><title type='text'>closing aux frame displays file save dialog</title><content type='html'>In CMainFrame::DetachView, must remove aux view from document.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    GetDoc()-&gt;RemoveView(m_AuxView);    // remove aux view from our document&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228428524899098?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228428524899098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228428524899098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228428524899098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228428524899098'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/closing-aux-frame-displays-file-save.html' title='closing aux frame displays file save dialog'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228423127393954</id><published>2006-04-11T00:43:00.000-07:00</published><updated>2006-10-31T01:43:50.800-08:00</updated><title type='text'>prevent non-client clicks from pausing app</title><content type='html'>The following works, provided the "Show window contents while dragging" system property is unchecked.  The only side effects are a) left-clicking on the menu bar moves the cursor to the center of the menu bar (strange, but not really a problem), and b) close happens on button down instead of button up.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;void CPersistDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)&lt;br /&gt;{&lt;br /&gt;    switch (nHitTest) {&lt;br /&gt;    case HTCLOSE:&lt;br /&gt;        SendMessage(WM_SYSCOMMAND, SC_CLOSE, 0);&lt;br /&gt;        break;&lt;br /&gt;    case HTCAPTION:&lt;br /&gt;        SendMessage(WM_SYSCOMMAND, SC_MOVE, 0);&lt;br /&gt;        break;&lt;br /&gt;    default:&lt;br /&gt;        CDialog::OnNcLButtonDown(nHitTest, point);&lt;br /&gt;        break;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CPersistDlg::OnNcRButtonDown(UINT nHitTest, CPoint point)&lt;br /&gt;{&lt;br /&gt;    switch (nHitTest) {&lt;br /&gt;    case HTCAPTION:&lt;br /&gt;    case HTSYSMENU:&lt;br /&gt;        SendMessage(WM_CONTEXTMENU, (LONG)m_hWnd, MAKELONG(point.x, point.y));&lt;br /&gt;        break;&lt;br /&gt;    default:&lt;br /&gt;        CDialog::OnNcRButtonDown(nHitTest, point);&lt;br /&gt;        break;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228423127393954?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228423127393954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228423127393954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228423127393954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228423127393954'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/prevent-non-client-clicks-from-pausing.html' title='prevent non-client clicks from pausing app'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228418658854429</id><published>2006-04-05T00:41:00.000-07:00</published><updated>2006-10-31T01:44:06.983-08:00</updated><title type='text'>benchmarks for drawing AVI frames</title><content type='html'>&lt;pre&gt;&lt;br /&gt;test video: "Movie_051112214725 comp.avi"&lt;br /&gt;Release mode&lt;br /&gt;Master Rings = 0&lt;br /&gt;Window size: 632 x 459&lt;br /&gt;# samples:      1000 (40 seconds)&lt;br /&gt;averages (times in seconds)&lt;br /&gt;&lt;br /&gt;Dell / Windows 2000&lt;br /&gt;---------------------&lt;br /&gt;using BitBlt, SRCCOPY&lt;br /&gt;total           0.032182 &lt;- i.e. avg duration of DrawAviFrame&lt;br /&gt;get frame       0.013667 (42.5%)&lt;br /&gt;create bitmap   0.009647 (30.0%)&lt;br /&gt;blit            0.008469 (26.3%)&lt;br /&gt;misc            0.000400 (1.2%)&lt;br /&gt;&lt;br /&gt;using StretchBlt, SRCCOPY&lt;br /&gt;total           0.047449 &lt;- exceeds timer period! 47% worse than BitBlt&lt;br /&gt;get frame       0.013653 (28.8%)&lt;br /&gt;create bitmap   0.009758 (20.6%)&lt;br /&gt;blit            0.023656 (49.9%)&lt;br /&gt;misc            0.000383 (0.8%)&lt;br /&gt;&lt;br /&gt;using StretchBlt, SRCINVERT&lt;br /&gt;total           0.059013 &lt;- 148% of timer period! 25% worse than SRCCOPY&lt;br /&gt;get frame       0.013646 (23.1%)&lt;br /&gt;create bitmap   0.010457 (17.7%)&lt;br /&gt;blit            0.034508 (58.5%)&lt;br /&gt;misc            0.000402 (0.7%)&lt;br /&gt;&lt;br /&gt;Hotrod / XP&lt;br /&gt;---------------------&lt;br /&gt;using BitBlt, SRCCOPY&lt;br /&gt;total           0.004478 &lt;- i.e. avg duration of DrawAviFrame&lt;br /&gt;get frame       0.002263 (50.5%)&lt;br /&gt;create bitmap   0.001238 (27.6%)&lt;br /&gt;blit            0.000881 (19.7%)&lt;br /&gt;misc            0.000096 (2.1%)&lt;br /&gt;&lt;br /&gt;using StretchBlt, SRCCOPY&lt;br /&gt;total           0.006912 &lt;- 54% worse than BitBlt&lt;br /&gt;get frame       0.002257 (32.7%)&lt;br /&gt;create bitmap   0.001240 (17.9%)&lt;br /&gt;blit            0.003314 (48.0%)&lt;br /&gt;misc            0.000100 (1.4%)&lt;br /&gt;&lt;br /&gt;using StretchBlt, SRCINVERT&lt;br /&gt;total           0.008200 &lt;- 20% of timer period, 19% worse than SRCCOPY&lt;br /&gt;get frame       0.002267 (27.6%)&lt;br /&gt;create bitmap   0.001239 (15.1%)&lt;br /&gt;blit            0.004592 (56.0%)&lt;br /&gt;misc            0.000102 (1.2%)&lt;br /&gt;&lt;br /&gt;Conclusion:&lt;br /&gt;Hotrod is 7.2 times faster, but StretchBlt mode is bad stuff.&lt;br /&gt;&lt;br /&gt;#include "benchmark.h"&lt;br /&gt;double  blitsum;&lt;br /&gt;double  createsum;&lt;br /&gt;double  getfrmsum;&lt;br /&gt;double  totsum;&lt;br /&gt;int samps;&lt;br /&gt;...&lt;br /&gt;totsum += b.Elapsed();&lt;br /&gt;samps++;&lt;br /&gt;if (samps == 1000) {&lt;br /&gt;    CString s;&lt;br /&gt;    double  total = totsum / samps;&lt;br /&gt;    double  getfrm = getfrmsum / samps;&lt;br /&gt;    double  create = createsum / samps;&lt;br /&gt;    double  blit = blitsum / samps;&lt;br /&gt;    double  misc = total - (getfrm + create + blit);&lt;br /&gt;    s.Format("total\t%f\ngetfrm\t%f (%.1f%%)\ncreate\t%f (%.1f%%)\nblit\t%f (%.1f%%)\nmisc\t%f (%.1f%%)", &lt;br /&gt;        total, &lt;br /&gt;        getfrm, getfrm / total * 100, &lt;br /&gt;        create, create / total * 100, &lt;br /&gt;        blit, blit / total * 100, &lt;br /&gt;        misc, misc / total * 100);&lt;br /&gt;    AfxMessageBox(s);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228418658854429?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228418658854429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228418658854429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228418658854429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228418658854429'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/04/benchmarks-for-drawing-avi-frames.html' title='benchmarks for drawing AVI frames'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228408997674636</id><published>2006-03-31T00:40:00.000-08:00</published><updated>2006-10-31T01:44:24.283-08:00</updated><title type='text'>effect of ROPs on background</title><content type='html'>&lt;pre&gt;&lt;br /&gt;reverse polish notation! read right to left!&lt;br /&gt;&lt;br /&gt;P       Selected pen&lt;br /&gt;D       Destination bitmap&lt;br /&gt;a       Bitwise AND&lt;br /&gt;n       Bitwise NOT (inverse)&lt;br /&gt;o       Bitwise OR&lt;br /&gt;x       Bitwise exclusive OR (XOR)&lt;br /&gt;&lt;br /&gt;1       R2_BLACK        0       makes everything black&lt;br /&gt;2       R2_NOTMERGEPEN  DPon    black outlining leaves bg unchanged, else pen is inverted and translucent (correct when bg is black, else darker)&lt;br /&gt;3       R2_MASKNOTPEN   DPna    black outlining leaves bg unchanged, else pen is inverted and translucent (correct when bg is white, else darker)&lt;br /&gt;4       R2_NOTCOPYPEN   Pn      overwrites bg, inverted drawing color&lt;br /&gt;5       R2_MASKPENNOT   PDna    white outlining leaves bg unchanged, else pen is translucent (correct when bg is black, else darker)&lt;br /&gt;6       R2_NOT          Dn      reverses bg: outlining or overlap shows bg unchanged (it's inverted twice)&lt;br /&gt;7       R2_XORPEN       DPx     the coolest&lt;br /&gt;8       R2_NOTMASKPEN   DPan    white outlining leaves bg unchanged, else pen is inverted and translucent (correct when bg is black, else lighter)&lt;br /&gt;9       R2_MASKPEN      DPa     white outlining leaves bg unchanged, else pen is translucent (correct when bg is white, else darker)&lt;br /&gt;10      R2_NOTXORPEN    DPxn    similar to xor&lt;br /&gt;11      R2_NOP          D       drawing is invisible&lt;br /&gt;12      R2_MERGENOTPEN  DPno    drawing in white leaves bg unchanged, else pen is inverted and translucent (opaque when bg is black)&lt;br /&gt;13      R2_COPYPEN      P       straight copy&lt;br /&gt;14      R2_MERGEPENNOT  PDno    black outlining leaves bg unchanged, else pen is translucent (correct when bg is white)&lt;br /&gt;15      R2_MERGEPEN     DPo     black outlining leaves bg unchanged, else pen is translucent (correct when bg is black)&lt;br /&gt;16      R2_WHITE        1       makes everything white&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228408997674636?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228408997674636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228408997674636' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228408997674636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228408997674636'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/03/effect-of-rops-on-background.html' title='effect of ROPs on background'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228405373352937</id><published>2006-03-25T00:40:00.000-08:00</published><updated>2006-10-31T01:44:43.093-08:00</updated><title type='text'>more zoom/origin hell</title><content type='html'>The really weird thing is, it looks much better if the origin DOESN'T move in mirror mode!!! So it's actually not broken at the moment, except for&lt;br /&gt;&lt;br /&gt;1) the move and return thing, and that's gone now that the normalized origin isn't zoomed&lt;br /&gt;2) the problem with trail (outer rings move when they shouldn't)&lt;br /&gt;3) make DIB must still use center zoom, otherwise scale to fit will screw up mirrored snapshots&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228405373352937?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228405373352937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228405373352937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228405373352937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228405373352937'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/03/more-zoomorigin-hell.html' title='more zoom/origin hell'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228401400824304</id><published>2006-03-23T00:39:00.000-08:00</published><updated>2006-10-31T01:45:04.296-08:00</updated><title type='text'>zoom/origin hell</title><content type='html'>Unmirrored zooming is supposed to be origin-centered, i.e. you zoom into or out of the ring origin. This isn't allowed in mirror mode because it would change the image. In mirror mode, you zoom into or out of the *mirror origin* (i.e. the center of the screen), and let the ring origin move as needed so that the image stays the same.&lt;br /&gt;&lt;br /&gt;origin behavior with zooming, version 1.1:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mirror  drag    behavior&lt;br /&gt;no      no      stationary: correct&lt;br /&gt;yes     no      moves: correct&lt;br /&gt;no      yes     stationary: correct&lt;br /&gt;yes     yes     stationary (or with damping, moves and then returns): BOGUS&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;origin behavior with zooming, version 1.3 (trail):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mirror  drag    behavior&lt;br /&gt;no      no      moves: BOGUS&lt;br /&gt;yes     no      moves: correct&lt;br /&gt;no      yes     stationary, but with damping, moves and then returns: BOGUS&lt;br /&gt;yes     yes     stationary (or with damping, moves and then returns): BOGUS&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that random origin may have the same problems as drag origin; it's hard to tell.&lt;br /&gt;&lt;br /&gt;Trail complicates things further, because if the origin moves and returns, the trail pattern is lost.&lt;br /&gt;&lt;br /&gt;Really there are two separate problems:&lt;br /&gt;&lt;br /&gt;1) The damping feature of the origin motion prevents the ring origin from moving during zoom, or causes it to slip back. As a result, zooming in mirror mode changes the mirror imagery. This behavior always occurred in mirror mode, but somehow it went unnoticed; adding trail made it more noticeable, by causing it to affect unmirrored mode also.&lt;br /&gt;&lt;br /&gt;The likely cause is that When you zoom in mirrored mode, the view's normalized origin changes, but the main frame's target origin (also in normalized space) DOESN'T change, so the view eventually slips back to the target origin. This can be solved by saving the normalized origin before zooming the view, and then correcting the target origin by the difference between the new normalized origin and the saved one.&lt;br /&gt;&lt;br /&gt;2) Adding trail broke zooming into the ring origin. It could be argued that this was a bad idea anyway and that we should always zoom into the mirror origin, in which case this bug is actually a feature. However, this argument doesn't really hold up, because zooming into the ring origin is typically more interesting than zooming into whatever happens to be in the center of the screen.&lt;br /&gt;&lt;br /&gt;This problem could possibly be solved by a temporary coordinate space change, so that the zoom scaling is done in ring-origin space instead of mirror-origin space. You could calculate the difference between the master ring origin and the center of the screen, and then for each ring, subtract the difference from its origin, multiply by zoom, and add the difference back on.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228401400824304?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228401400824304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228401400824304' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228401400824304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228401400824304'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/03/zoomorigin-hell.html' title='zoom/origin hell'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228396878956027</id><published>2006-03-20T00:39:00.000-08:00</published><updated>2006-10-31T02:10:07.856-08:00</updated><title type='text'>FillPath vs. StrokeAndFillPath</title><content type='html'>benchmark of FillPath vs. StrokeAndFillPath with null brush:&lt;br /&gt;no significant difference&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228396878956027?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228396878956027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228396878956027' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228396878956027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228396878956027'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/03/fillpath-vs-strokeandfillpath.html' title='FillPath vs. StrokeAndFillPath'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228394706901997</id><published>2006-03-20T00:38:00.000-08:00</published><updated>2006-10-31T01:45:43.803-08:00</updated><title type='text'>uniform curvature with respect to number of sides</title><content type='html'>&lt;pre&gt;&lt;br /&gt;// decrease curvature as number of sides increases&lt;br /&gt;// behavior is somewhat more orderly but not as interesting either&lt;br /&gt;double  s = 1.0f / float(Ring.Sides - 2);&lt;br /&gt;Ring.EvenCurve = float(m_Parms.EvenCurve * s);&lt;br /&gt;Ring.OddCurve = float(m_Parms.OddCurve * s);&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228394706901997?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228394706901997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228394706901997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228394706901997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228394706901997'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/03/uniform-curvature-with-respect-to.html' title='uniform curvature with respect to number of sides'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228388084108168</id><published>2006-02-28T00:37:00.001-08:00</published><updated>2006-10-31T01:46:53.400-08:00</updated><title type='text'>help changes for 1.3</title><content type='html'>add Random Ramp to Waveforms GIF (done)&lt;br /&gt;add Trail to Master Controls (done)&lt;br /&gt;add Convex to Trail (done)&lt;br /&gt;add Convex to Effects (done)&lt;br /&gt;modify Origin Motion for Trail (done)&lt;br /&gt;modify Mouse Modes for Trail (done)&lt;br /&gt;modify Canvas Scale for new origin limits (done)&lt;br /&gt;modify Zoom for new origin limits and Window/Zoom (done)&lt;br /&gt;modify Panic for Trail reset (done)&lt;br /&gt;update shortcut tables (done)&lt;br /&gt;add Trail to features list on web site (done)&lt;br /&gt;idea: comprehensive list of menu commands?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228388084108168?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228388084108168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228388084108168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228388084108168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228388084108168'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/help-changes-for-13.html' title='help changes for 1.3'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228384869303124</id><published>2006-02-28T00:37:00.000-08:00</published><updated>2006-10-31T01:47:11.500-08:00</updated><title type='text'>help changes for 1.2</title><content type='html'>Master offsets are now saved. Affected topics: Master Offsets, Playlists&lt;br /&gt;Add oscillator override (new topic)&lt;br /&gt;Add MIDI setup's Advanced checkbox&lt;br /&gt;Zero controllers / Panic reset oscillator frequency overrides&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228384869303124?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228384869303124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228384869303124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228384869303124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228384869303124'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/help-changes-for-12.html' title='help changes for 1.2'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228339683226110</id><published>2006-02-27T00:28:00.000-08:00</published><updated>2006-10-31T01:47:29.560-08:00</updated><title type='text'>MIDI color oscillator overrides</title><content type='html'>Frequency AND amplitude, for each color component (HLS), for both foreground and background color is 2 * 3 * 2 = 12 knobs. It turns out to be too much to handle live. Better to control the frequencies only, and hard-code the amplitudes:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;                amp     freq (range)&lt;br /&gt;color speed     1       .1&lt;br /&gt;lightness       .25     .1&lt;br /&gt;saturation      .5      .1&lt;br /&gt;bk hue          180     .01&lt;br /&gt;bk lightness    .25     .1&lt;br /&gt;bk saturation   .5      .1&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228339683226110?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228339683226110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228339683226110' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228339683226110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228339683226110'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/midi-color-oscillator-overrides.html' title='MIDI color oscillator overrides'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228331167584240</id><published>2006-02-23T00:28:00.000-08:00</published><updated>2006-10-31T01:46:32.010-08:00</updated><title type='text'>don't draw to video memory</title><content type='html'>Supposedly mirrored mode is faster because it reduces drawing by 3/4, but even if this difference is eliminated (by restricting drawing to the upper left quadrant), mirrored mode is STILL faster. The reason is that mirrored mode always draws to system memory. The solution is to draw to system memory in all cases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228331167584240?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228331167584240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228331167584240' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228331167584240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228331167584240'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/dont-draw-to-video-memory.html' title='don&apos;t draw to video memory'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228329062997732</id><published>2006-02-07T00:27:00.000-08:00</published><updated>2006-10-31T01:46:11.396-08:00</updated><title type='text'>awesome matt trail demo</title><content type='html'>patch "pinwheel fab color", master 158, zoom 119, damping 95.5, tempo 14.96, unmirrored, fill, outline (requires serious hotrod action)&lt;br /&gt;&lt;br /&gt;This demo proves that trail is way better than odd shift and should be up next on the enhancement list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228329062997732?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228329062997732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228329062997732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228329062997732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228329062997732'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/awesome-matt-trail-demo.html' title='awesome matt trail demo'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228326786575712</id><published>2006-02-03T00:27:00.000-08:00</published><updated>2006-10-31T01:47:49.586-08:00</updated><title type='text'>allow user to register BmpToAvi</title><content type='html'>Cool idea, but unnecessary: now that the installer correctly handles upgrading (each release must have a new project GUID, but the same upgrade GUID), this situation can't arise anymore.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;if (bta.GetLastError() == CBmpToAvi::ERR_CREATE_SOURCE&lt;br /&gt;&amp;&amp; hr == REGDB_E_CLASSNOTREG) {&lt;br /&gt;    static const LPCSTR BmpToAviName = "BmpToAvi.ax";&lt;br /&gt;    if (AfxMessageBox(IDS_MEX_BTA_INSTALL, MB_YESNO) == IDYES) {&lt;br /&gt;        CPathStr    path = CMainFrame::GetAppPath();&lt;br /&gt;        path.Append(BmpToAviName);&lt;br /&gt;        if (PathFileExists(path)) {&lt;br /&gt;            CString cmd;&lt;br /&gt;            cmd.Format("regsvr32 /s \"%s\"", path);&lt;br /&gt;            int retc = system(cmd);&lt;br /&gt;            if (retc)&lt;br /&gt;                AfxMessageBox(IDS_MEX_BTA_CANT_REG);&lt;br /&gt;            else&lt;br /&gt;                goto retry;&lt;br /&gt;        } else {&lt;br /&gt;            CString s;&lt;br /&gt;            s.Format(IDS_MEX_BTA_NOT_FOUND, BmpToAviName);&lt;br /&gt;            AfxMessageBox(s);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228326786575712?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228326786575712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228326786575712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228326786575712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228326786575712'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/allow-user-to-register-bmptoavi.html' title='allow user to register BmpToAvi'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228323611435808</id><published>2006-02-03T00:26:00.000-08:00</published><updated>2006-10-31T01:48:06.540-08:00</updated><title type='text'>no more 2 GB limit</title><content type='html'>I took a look at the OpenDML stuff, but in the end I decided to solve this the MS way: I wrote my own DirectShow show source filter that inserts frames (as bitmaps) into a video stream.&lt;br /&gt;&lt;br /&gt;That turned out to be the *easy* part! The SDK's "ball" example was a pretty good starting part for writing a DirectShow source filter. The only real problem is that the ball filter draws the frames itself, whereas I needed to draw the frames in the application, and then pass them to the source filter. Turns out MS thought of that: you can override the DoBufferProcessingLoop function, cool.&lt;br /&gt;&lt;br /&gt;There's also the minor detail of how to call my filter's "add frame" function from the application: turns out that requires creating a new COM interface. A bit of research, but not too bad. And of course I need some application code to create a filter graph, connect all the "pins" together and run the graph. There are examples of this all over the place, nothing new here.&lt;br /&gt;&lt;br /&gt;The real problem came from an unexpected direction: how to set the video compression options? The Vfw AVIFile API had a wonderful function called AVISaveOptions: it displayed a dialog listing all your video compressors, and allowed you to select one and configure it. And in DirectShow? Nothing like that exists. Insane but true.&lt;br /&gt;&lt;br /&gt;So I wound up writing a DirectShow Video Compression dialog object. You pass it your source and destination filters, and it displays the dialog, and returns a fully-configured compressor filter.&lt;br /&gt;&lt;br /&gt;The bottom line? I have developed two reusable technologies:&lt;br /&gt;1) A DirectShow BMP to AVI converter.&lt;br /&gt;2) A DirectShow Video Compression dialog&lt;br /&gt;&lt;br /&gt;I suspect both could be useful to other developers, so I'm going to submit them to CodeProject later. Right now my priority is integrating them into a new version of Whorld.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228323611435808?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228323611435808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228323611435808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228323611435808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228323611435808'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/no-more-2-gb-limit.html' title='no more 2 GB limit'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228319046350856</id><published>2006-02-01T00:25:00.000-08:00</published><updated>2006-10-31T01:48:25.570-08:00</updated><title type='text'>data rates</title><content type='html'>In AVIFile's Video Compression dialog, tried setting data rate for a few encoders:&lt;br /&gt;indeo video 5.1&lt;br /&gt;Intel indeo video R3.2&lt;br /&gt;used steve1, crop, 320x240, frames 5000-5200&lt;br /&gt;In both cases, checking the box caused the data rate in the file to drop by almost half REGARDLESS of what number was typed for data rate. crazy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228319046350856?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228319046350856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228319046350856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228319046350856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228319046350856'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/data-rates.html' title='data rates'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228312363827468</id><published>2006-02-01T00:24:00.000-08:00</published><updated>2006-10-31T01:54:30.643-08:00</updated><title type='text'>Things that weren't obvious</title><content type='html'>1) IAMVfwCompressDialogs must be used AFTER THE COMPRESSOR IS CONNECTED, otherwise Configure ignores SetState and reinitializes the dialog every time&lt;br /&gt;2) IAMVideoCompression must be created on the OUTPUT PIN of the compressor, not the on compressor itself&lt;br /&gt;3) any size other than 320 x 240 causes first-chance exception in QCAP.DLL (debug only)&lt;br /&gt;&lt;br /&gt;more problems: can't seem to set output bit rate, maybe that just doesn't work&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;IPin    *pComprOut = CDSBmpToAvi::GetPin(ip-&gt;pCompr, PINDIR_OUTPUT);&lt;br /&gt;if (pComprOut != NULL) {    // if we got compressor's output pin&lt;br /&gt;    IAMStreamConfig *pStreamCfg = NULL;&lt;br /&gt;    m_hr = pComprOut-&gt;QueryInterface(   // get IAMVideoCompression&lt;br /&gt;        IID_IAMStreamConfig, (void **)&amp;pStreamCfg);&lt;br /&gt;    if (pStreamCfg != NULL) {   // do GetFormat after input pin is connected&lt;br /&gt;        AM_MEDIA_TYPE   *pmt;&lt;br /&gt;        m_hr = pStreamCfg-&gt;GetFormat(&amp;pmt);&lt;br /&gt;        if (SUCCEEDED(m_hr)) {&lt;br /&gt;            printf("get format ok\n");&lt;br /&gt;            if (pmt-&gt;formattype == FORMAT_VideoInfo) {&lt;br /&gt;                VIDEOINFOHEADER *pvh = (VIDEOINFOHEADER *)pmt-&gt;pbFormat;&lt;br /&gt;                printf("%d\n", pvh-&gt;dwBitRate);&lt;br /&gt;                pvh-&gt;dwBitRate = 10000;&lt;br /&gt;                m_hr = pStreamCfg-&gt;SetFormat(pmt);&lt;br /&gt;                if (SUCCEEDED(m_hr)) {&lt;br /&gt;                    printf("set format ok\n");&lt;br /&gt;                }&lt;br /&gt;    //          DeleteMediaType(pmt);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228312363827468?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228312363827468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228312363827468' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228312363827468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228312363827468'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/02/things-that-werent-obvious.html' title='Things that weren&apos;t obvious'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228307952441693</id><published>2006-01-29T00:21:00.000-08:00</published><updated>2006-10-31T01:54:50.043-08:00</updated><title type='text'>DirectShow source filter</title><content type='html'>CodeGuru's snake sample prog doesn't work, it hangs&lt;br /&gt;to register or unregister a filter (e.g. ball.ax):&lt;br /&gt;regsrv32 ball.ax&lt;br /&gt;regsrv32 /u ball.ax&lt;br /&gt;then draw a filter graph using graphedt.exe&lt;br /&gt;to view, connect ball -&gt; video renderer&lt;br /&gt;to create AVI file, connect ball -&gt; AVI mux -&gt; file writer&lt;br /&gt;this works fine, but important questions remain&lt;br /&gt;1) how do you run the filter chain without using graphedt?&lt;br /&gt;2) how do you get the app to communicate the frames to the filter?&lt;br /&gt;3) where does the source filter's GUID come from?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228307952441693?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228307952441693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228307952441693' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228307952441693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228307952441693'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/01/directshow-source-filter.html' title='DirectShow source filter'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228277932748827</id><published>2006-01-10T00:19:00.000-08:00</published><updated>2006-10-31T01:55:10.336-08:00</updated><title type='text'>invalid pixel format</title><content type='html'>Ben C's Gateway won't run Whorld in DirectDraw mode: it gives the error DDERR_INVALIDPIXELFORMAT. He initially had DirectX 8.0, I upgraded to 8.1 but it didn't help. Checked the Display Settings, he had 24-bit 1024x768. Tried 640x480, didn't help. Try 16-bit color?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228277932748827?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228277932748827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228277932748827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228277932748827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228277932748827'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/01/invalid-pixel-format.html' title='invalid pixel format'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228275461228923</id><published>2006-01-03T00:18:00.000-08:00</published><updated>2006-10-31T01:55:26.026-08:00</updated><title type='text'>POINTF vs DPOINT</title><content type='html'>Using POINTF (e.g. for Pucker) saves 8 bytes in the RING struct, which reduces the disk throughput requirements for snapshot movies. It doesn't seem to measureably worsen CPU usage. The downside is trading 15 digits of precision for 7. For items that remain constant over the life of a ring (e.g. Pucker), it might not matter, but for items that are incremented per frame (e.g. origin), it definitely *does* matter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228275461228923?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228275461228923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228275461228923' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228275461228923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228275461228923'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2006/01/pointf-vs-dpoint.html' title='POINTF vs DPOINT'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228273253083130</id><published>2005-12-22T00:18:00.000-08:00</published><updated>2006-10-31T01:55:40.310-08:00</updated><title type='text'>hogging CPU breaks About dialog</title><content type='html'>If main is saturating the CPU, Help/About makes the app modal, but no dialog is displayed.  The bug occurs with any dialog created via DoModal, but it does NOT occur with the common dialogs (e.g. CFileDialog), presumably because they use a different creation method.  Help/About is currently the only non-common modal dialog accessible directly from the main menu, which is why the bug wasn't discovered earlier.&lt;br /&gt;&lt;br /&gt;One workaround is to disable the main timer in CAboutDlg::OnInitDialog, and then re-enable it in ShowWindow.  An easier one is to do an explicit ShowWindow in CAboutDlg::OnInitDialog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228273253083130?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228273253083130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228273253083130' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228273253083130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228273253083130'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/12/hogging-cpu-breaks-about-dialog.html' title='hogging CPU breaks About dialog'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228270939346146</id><published>2005-12-21T00:17:00.000-08:00</published><updated>2006-10-31T01:55:56.516-08:00</updated><title type='text'>changing hue loop length</title><content type='html'>Changing the hue loop length without compensation causes distracting jumps in hue.  Reflecting the hue position prevents jumps entirely when the loop length is increased, and minimizes the probability of a jump when the loop length is decreased.  Without changing the base position, it's impossible to prevent jumps entirely in the latter case, because the current hue may no longer fall within the range of the loop.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;if (m_st.HueLoop &amp;&amp; m_st.HueLoopLength) // try to avoid hue jump&lt;br /&gt; m_st.HueLoopPos = Reflect(m_st.HueLoopPos, m_st.HueLoopLength);&lt;br /&gt;m_st.HueLoopLength = Length;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228270939346146?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228270939346146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228270939346146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228270939346146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228270939346146'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/12/changing-hue-loop-length.html' title='changing hue loop length'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228240973626231</id><published>2005-11-11T00:13:00.000-08:00</published><updated>2006-10-31T01:56:12.626-08:00</updated><title type='text'>limiting random origin motion</title><content type='html'>&lt;pre&gt;&lt;br /&gt;double  RandOrgRange = 1;   // 0 to 2, default is 1&lt;br /&gt;DPOINT  RandOrgBias = {0, 0};   // -.5 to .5, default is 0&lt;br /&gt;double  ofs = (1 - RandOrgRange) / 2;&lt;br /&gt;m_TargetOrg.x = double(rand()) / RAND_MAX&lt;br /&gt;    * RandOrgRange + ofs + RandOrgBias.x;&lt;br /&gt;m_TargetOrg.y = double(rand()) / RAND_MAX&lt;br /&gt;    * RandOrgRange + ofs + RandOrgBias.y;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228240973626231?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228240973626231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228240973626231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228240973626231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228240973626231'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/11/limiting-random-origin-motion.html' title='limiting random origin motion'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228265655874448</id><published>2005-11-09T00:13:00.000-08:00</published><updated>2006-10-31T01:56:37.043-08:00</updated><title type='text'>seed of life</title><content type='html'>It's dependent on the frame rate.  Frame rate, birth rate, ring spacing, and skew angle delta interact to determine how many ring tunnels are generated.&lt;br /&gt;&lt;br /&gt;If birth rate = 1, ring spacing = 5, and skew angle freq = 1, at 25 FPS you get 5 ring tunnels (a 5-way seed of life), because you're generating 5 rings per second, and each ring has a fifth of the skew angle delta (.2 Hz = 72 degrees), and 5 clock ticks.&lt;br /&gt;&lt;br /&gt;at 30 FPS, with the same settings, you get a 6-way seed of life.&lt;br /&gt;&lt;br /&gt;Color speed can also be adjusted to achieve a constant color for each tunnel.  14.4 (a fifth of 72) works for the 5-way at skew angle = 1; 90 works for most of the others.&lt;br /&gt;&lt;br /&gt;Since the rings continue to intersect at the origin no matter how big they get, the rings will never be entirely off-canvas, and thus will never be deleted.  This is a dangerous side effect and yet another argument for a max rings parameter.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Useful formulas:&lt;br /&gt;        Birth   Ring    Skew    ring    color&lt;br /&gt;FPS     Rate    Space   Ang Hz  tunnels speed&lt;br /&gt;25      .25     5       1.25    1       90&lt;br /&gt;25      .5      5       1.25    2       90&lt;br /&gt;25      .75     5       1.25    3       90&lt;br /&gt;25      1       5       1.25    4       90&lt;br /&gt;25      1.25    5       1.25    5       72&lt;br /&gt;25      1.5     5       1.25    6       90&lt;br /&gt;25      1.75    5       1.25    7       90*&lt;br /&gt;25      2       5       1.25    8       90*&lt;br /&gt;25      2.25    5       1.25    9       90*&lt;br /&gt;25      2.5     5       1.25    10      72*&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;*colors are stable but tunnels don't appear in spectral order&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228265655874448?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228265655874448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228265655874448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228265655874448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228265655874448'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/11/seed-of-life.html' title='seed of life'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228237796648872</id><published>2005-10-27T00:12:00.000-07:00</published><updated>2006-10-31T01:56:58.666-08:00</updated><title type='text'>objects needing more comments</title><content type='html'>ctrlresize, replacefilesdlg, masterdlg, parmrow, playlist, numbersdlg, viewdialog&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228237796648872?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228237796648872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228237796648872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228237796648872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228237796648872'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/objects-needing-more-comments.html' title='objects needing more comments'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228235888406119</id><published>2005-10-25T00:12:00.000-07:00</published><updated>2006-10-31T01:57:16.470-08:00</updated><title type='text'>adding HLS color to existing snapshots</title><content type='html'>&lt;pre&gt;&lt;br /&gt;ar &lt;&lt; sizeof(RING);&lt;br /&gt;ar &lt;&lt; m_Ring.GetCount();&lt;br /&gt;POSITION    pos = m_Ring.GetHeadPosition();&lt;br /&gt;for (int i = 0; i &lt; m_Ring.GetCount(); i++) {&lt;br /&gt;    RING    rp = m_Ring.GetNext(pos);&lt;br /&gt;    double  h, l, s;&lt;br /&gt;    int c = rp.Color;&lt;br /&gt;    CHLS::rgb2hls(GetRValue(c) / 255.0, &lt;br /&gt;        GetGValue(c) / 255.0, GetBValue(c) / 255.0, h, l, s);&lt;br /&gt;    rp.Hue = h;&lt;br /&gt;    rp.Lightness = l;&lt;br /&gt;    rp.Saturation = s;&lt;br /&gt;    ar.Write(&amp;rp, sizeof(RING));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228235888406119?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228235888406119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228235888406119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228235888406119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228235888406119'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/adding-hls-color-to-existing-snapshots.html' title='adding HLS color to existing snapshots'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228231910765546</id><published>2005-10-24T00:11:00.000-07:00</published><updated>2006-10-31T01:57:32.483-08:00</updated><title type='text'>Movie format could save space</title><content type='html'>The movies are using the snapshot format, which includes all of the ring info.  In the ring info, the rotation and shift deltas and the HLS color are not used at all during movie playback.  These attributes constitute 40 bytes out of 120, or one third of the total size of the ring structure.  The actual savings could be nearly a third, since most of the space in a movie is taken up by rings (hundreds of rings per frame).&lt;br /&gt;&lt;br /&gt;The savings would require adding a second serialization method, e.g. MiniSerialize, which would be used by the SnapMovie object.  The method could be optimized by placing the deltas and the HLS color at the start of the ring structure, because then it would still be possible to do a single write directly from the ring, instead of copying to an intermediate structure first.&lt;br /&gt;&lt;br /&gt;A problem with this approach is that it would longer be possible to export a complete (non-mini) snapshot from a movie, since some of the information would be missing.  The HLS color could be restored from RGB, but not the deltas.  On the other hand the deltas aren't useful in snapshots so maybe it wouldn't matter.&lt;br /&gt;&lt;br /&gt;NOTE that WinZip reduces Steve1.whm by 61%, and Steve2.whm by 73%.&lt;br /&gt;&lt;br /&gt;Space-saving benchmarks:&lt;br /&gt;&lt;br /&gt;60 seconds, 25 FPS, default speed, window maximized but not full-screen, wait for full ring count before starting to record, sizes in MB, ring counts are rough averages&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;patch           rings   old     new     less&lt;br /&gt;kaleid          1000    172.5   108.8   37%&lt;br /&gt;pinwheel        500     98.0    62.5    36%&lt;br /&gt;lotus light     300     71.4    46.5    35%&lt;br /&gt;cross           150     34.6    26.3    24%&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;useful nugget of ring conversion code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;nr.RotDelta = rp.RotDelta;&lt;br /&gt;nr.ShiftDelta = rp.ShiftDelta;&lt;br /&gt;nr.Hue = rp.Hue;&lt;br /&gt;nr.Lightness = rp.Lightness;&lt;br /&gt;nr.Saturation = rp.Saturation;&lt;br /&gt;nr.Rot = rp.Rot;&lt;br /&gt;nr.Steps = rp.Steps;&lt;br /&gt;nr.Scale = rp.Scale;&lt;br /&gt;nr.Shift = rp.Shift;&lt;br /&gt;nr.StarRatio = rp.StarRatio;&lt;br /&gt;nr.Sides = rp.Sides;&lt;br /&gt;nr.Delete = rp.Delete;&lt;br /&gt;nr.Reverse = rp.Reverse;&lt;br /&gt;nr.Color = rp.Color;&lt;br /&gt;nr.Pinwheel = rp.Pinwheel;&lt;br /&gt;nr.LineWidth = rp.LineWidth;&lt;br /&gt;nr.DrawMode = rp.DrawMode;&lt;br /&gt;nr.Spacing = rp.Spacing;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228231910765546?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228231910765546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228231910765546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228231910765546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228231910765546'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/movie-format-could-save-space.html' title='Movie format could save space'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228229337302496</id><published>2005-10-20T00:10:00.000-07:00</published><updated>2006-10-31T01:57:50.226-08:00</updated><title type='text'>array of CArrays not optimized correctly</title><content type='html'>It looks like dereferencing an array of CArray objects can causes MFC to call the [] operator, instead of inlining it, even in Release mode.  Presumably this is why:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int CPlaylistDlg::FindHotKey(DWORD HotKey) const&lt;br /&gt;{&lt;br /&gt;    int Patches = GetCount();&lt;br /&gt;    for (int i = 0; i &lt; Patches; i++) {&lt;br /&gt;        if (HotKey == m_Bank[m_CurBank][i].m_HotKey)&lt;br /&gt;            return(i);&lt;br /&gt;    }&lt;br /&gt;    return(-1);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;generates twice as much code as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int CPlaylistDlg::FindHotKey(DWORD HotKey) const&lt;br /&gt;{&lt;br /&gt;    int Patches = GetCount();&lt;br /&gt;    for (int i = 0; i &lt; Patches; i++) {&lt;br /&gt;        if (HotKey == (*m_Patch)[i].m_HotKey)&lt;br /&gt;            return(i);&lt;br /&gt;    }&lt;br /&gt;    return(-1);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Oddly, this is bad too:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int CPlaylistDlg::FindHotKey(DWORD HotKey) const&lt;br /&gt;{&lt;br /&gt;    int Patches = GetCount();&lt;br /&gt;    const PATCH_LIST    *p  = &amp;m_Bank[m_CurBank];&lt;br /&gt;    for (int i = 0; i &lt; Patches; i++) {&lt;br /&gt;        if (HotKey == (*p)[i].m_HotKey)&lt;br /&gt;            return(i);&lt;br /&gt;    }&lt;br /&gt;    return(-1);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;but this is fine (1 line longer than original):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int CPlaylistDlg::FindHotKey(DWORD HotKey) const&lt;br /&gt;{&lt;br /&gt;    int Patches = GetCount();&lt;br /&gt;    for (int i = 0; i &lt; Patches; i++) {&lt;br /&gt;        if (HotKey == m_Bank[m_CurBank].GetData()[i].m_HotKey)&lt;br /&gt;            return(i);&lt;br /&gt;    }&lt;br /&gt;    return(-1);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228229337302496?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228229337302496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228229337302496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228229337302496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228229337302496'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/array-of-carrays-not-optimized.html' title='array of CArrays not optimized correctly'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228223360932431</id><published>2005-10-08T00:10:00.000-07:00</published><updated>2006-10-31T01:54:14.490-08:00</updated><title type='text'>MainFrame bloat</title><content type='html'>2662 lines and counting, ouch&lt;br /&gt;non-message handlers 1139&lt;br /&gt;message map 166&lt;br /&gt;message handlers 1200&lt;br /&gt;&lt;br /&gt;things that could move easily:&lt;br /&gt;ShowDemo: only 32 lines but could get bigger&lt;br /&gt;&lt;br /&gt;not so easy&lt;br /&gt;GetInput: 83 lines and could get bigger&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228223360932431?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228223360932431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228223360932431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228223360932431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228223360932431'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/mainframe-bloat.html' title='MainFrame bloat'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228214313284620</id><published>2005-10-08T00:08:00.000-07:00</published><updated>2006-10-31T01:53:51.150-08:00</updated><title type='text'>odd shift</title><content type='html'>&lt;pre&gt;&lt;br /&gt;double  xshift[2] = {rp.Shift.x * m_st.Zoom, (rp.Shift.x + rp.OddShift.x) * m_st.Zoom};&lt;br /&gt;double  yshift[2] = {rp.Shift.y * m_st.Zoom, (rp.Shift.y + rp.OddShift.y) * m_st.Zoom};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Notice that the calculation is NOT corrected for radius.  This causes the effect to decrease with distance from the origin.  Correcting for radius gives a very different and less pleasing effect.  The display becomes too busy, and at extreme values, the image is distorted into a narrow cylinder.  The first objection could possibly be addressed by limiting the size of the ring list.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;To correct the above for radius:&lt;br /&gt;double  xshift[2] = {rp.Shift.x * m_st.Zoom, (rp.Shift.x + rp.OddShift.x * rp.Steps) * m_st.Zoom};&lt;br /&gt;double  yshift[2] = {rp.Shift.y * m_st.Zoom, (rp.Shift.y + rp.OddShift.y * rp.Steps) * m_st.Zoom};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Some possible names for "odd shift":&lt;br /&gt;&lt;br /&gt;Shear: incorrect usage&lt;br /&gt;Extrude: incorrect usage&lt;br /&gt;Tilt: too vague&lt;br /&gt;Tunnel: too vague, also other parameters can produce this effect&lt;br /&gt;Relief: too vague&lt;br /&gt;Stamen: too obscure&lt;br /&gt;Center Fold: misleading, the new version corrects for radius, see below&lt;br /&gt;Splay: means legs spread at various angles, not various lengths&lt;br /&gt;Deform: vague, not a noun, misleading negative connotations&lt;br /&gt;Bias: misleading connotation of unfairness&lt;br /&gt;Fold: vague, possibly misleading&lt;br /&gt;Asymmetry: vague, too long a word&lt;br /&gt;&lt;br /&gt;10/29/05 corrected for radius but also centered, much better&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DPOINT  splay = {rp.Splay.x * rp.Steps, rp.Splay.y * rp.Steps};&lt;br /&gt;double  xshift[2] = {&lt;br /&gt;    (rp.Shift.x - splay.x) * m_st.Zoom, &lt;br /&gt;    (rp.Shift.x + splay.x) * m_st.Zoom};&lt;br /&gt;double  yshift[2] = {&lt;br /&gt;    (rp.Shift.y - splay.y) * m_st.Zoom, &lt;br /&gt;    (rp.Shift.y + splay.y) * m_st.Zoom};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Controls should be polar as with Skew: Splay Radius, Splay Angle&lt;br /&gt;&lt;br /&gt;Some interesting interdependent terms:&lt;br /&gt;Contort: Twist, wrench, or bend severely out of shape&lt;br /&gt;Pinch: To press, squeeze, or bind painfully&lt;br /&gt;Buckle: Bending, warping, or crumpling; a bend or bulge&lt;br /&gt;Rumple: An irregular or untidy crease&lt;br /&gt;Crumple: To crush together or press into wrinkles; rumple&lt;br /&gt;Crease: A line made by pressing, folding, or wrinkling&lt;br /&gt;Wrinkle: A small furrow, ridge, or crease on a normally smooth surface&lt;br /&gt;Pucker: To gather into small wrinkles or folds&lt;br /&gt;&lt;br /&gt;And the winner as of 12/17/05 is:&lt;br /&gt;PUCKER&lt;br /&gt;&lt;br /&gt;totally cool demo: default patch, ring spacing 11.192, pucker radius -.406, pucker angle -65.88 / ramp up / 180 / .08, master speed 222&lt;br /&gt;&lt;br /&gt;another one: patch_051028050234, rings = 75, pucker rad = .268, angle = ramp up / 180 / .5, speed = 495&lt;br /&gt;&lt;br /&gt;optimized 12/19/05 (two less Zoom multiplications):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DPOINT  pucker = {rp.Pucker.x * steps, rp.Pucker.y * steps};&lt;br /&gt;DPOINT  shift = {rp.Shift.x * m_st.Zoom, rp.Shift.y * m_st.Zoom};&lt;br /&gt;double  xshift[2] = {shift.x - pucker.x, shift.x + pucker.x};&lt;br /&gt;double  yshift[2] = {shift.y - pucker.y, shift.y + pucker.y};&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228214313284620?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228214313284620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228214313284620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228214313284620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228214313284620'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/odd-shift.html' title='odd shift'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228182179243151</id><published>2005-10-08T00:03:00.000-07:00</published><updated>2006-10-31T01:50:23.373-08:00</updated><title type='text'>ring list size limit</title><content type='html'>&lt;pre&gt;&lt;br /&gt;in AddRing, at the very end:&lt;br /&gt;while (m_Ring.GetCount() &gt; whatever) {&lt;br /&gt;    if (Ring.Reverse)&lt;br /&gt;        m_Ring.RemoveHead();&lt;br /&gt;    else&lt;br /&gt;        m_Ring.RemoveTail();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228182179243151?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228182179243151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228182179243151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228182179243151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228182179243151'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/ring-list-size-limit.html' title='ring list size limit'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228179343965838</id><published>2005-10-08T00:02:00.000-07:00</published><updated>2006-10-31T01:50:06.813-08:00</updated><title type='text'>Bézier curves</title><content type='html'>&lt;pre&gt;&lt;br /&gt;in Draw:&lt;br /&gt;#if 1&lt;br /&gt;    m_pa[i] = m_pa[0];  // close the shape&lt;br /&gt;    Polyline(dc, m_pa, sides + 1);&lt;br /&gt;#else&lt;br /&gt;    CPoint  pt2[200];&lt;br /&gt;    int j = 0;&lt;br /&gt;    for (int i = 0; i &lt; sides; i++) {&lt;br /&gt;        pt2[j++] = m_pa[i];&lt;br /&gt;        if (i &amp; 1)&lt;br /&gt;            pt2[j++] = CPoint(m_pa[i].x, m_pa[i].y);&lt;br /&gt;    }&lt;br /&gt;    pt2[j++] = pt2[0];&lt;br /&gt;    PolyBezier(dc, pt2, j);&lt;br /&gt;#endif&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228179343965838?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228179343965838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228179343965838' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228179343965838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228179343965838'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/bzier-curves.html' title='Bézier curves'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228176050635191</id><published>2005-10-01T00:01:00.001-07:00</published><updated>2006-10-31T01:49:35.256-08:00</updated><title type='text'>scene rotation</title><content type='html'>&lt;pre&gt;&lt;br /&gt;in DefState:&lt;br /&gt;    0   // Rotation&lt;br /&gt;&lt;br /&gt;in Addring:&lt;br /&gt;    Ring.Rot = Ring.RotDelta * Offset + m_st.Rotation;&lt;br /&gt;&lt;br /&gt;void CWhorldView::Rotate(double Degrees, bool Repaint)&lt;br /&gt;{&lt;br /&gt;    POSITION    pos = m_Ring.GetHeadPosition();&lt;br /&gt;    double  r = DTR(Degrees);&lt;br /&gt;    while (pos != NULL) {&lt;br /&gt;        RING&amp;   Ring = m_Ring.GetNext(pos);&lt;br /&gt;        Ring.Rot += r;&lt;br /&gt;    }&lt;br /&gt;    m_st.Rotation = fmod(m_st.Rotation + r, 2 * PI);    // wrap to limit magnitude&lt;br /&gt;    if (Repaint)&lt;br /&gt;        Invalidate();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that this causes unexpected behavior (addition, subtraction, cancelation) when rotation is inverse of LFO rotation.  Also X/Y shifts are NOT rotated, so for example if Aspect Ratio is 2, the asymmetry will remain orthogonal instead of rotating.  Solving this would require changes to the drawing code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228176050635191?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228176050635191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228176050635191' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228176050635191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228176050635191'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/scene-rotation.html' title='scene rotation'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228171168585521</id><published>2005-10-01T00:01:00.000-07:00</published><updated>2006-10-31T01:49:52.153-08:00</updated><title type='text'>benchmarks for movie recording</title><content type='html'>------------&lt;br /&gt;PIII, Kaleid, 1024 x 768, 30 FPS, speed = 680, 2500 samps: min = .001197, max = .004851, avg = .001821, sdev = .000362&lt;br /&gt;&lt;br /&gt;avg .002 = .06 @ second = 6% avg usage for recording&lt;br /&gt;-----------&lt;br /&gt;AMD, Kaleid, 1024 x 768, 30 FPS, speed = 680, 2500 samps: min = .000167, max = .000611, avg = .000322, sdev = 8.8329E-05&lt;br /&gt;&lt;br /&gt;avg .0003 = .009 @ second = .9% avg usage for recording&lt;br /&gt;------------&lt;br /&gt;AMD test repeated over 5 minutes: min = .000172, max = .005491, avg = .000485, sdev = .000129&lt;br /&gt;&lt;br /&gt;all samples were &lt; than 1 ms except for a single single spike of 0.005491 at 3:38&lt;br /&gt;------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228171168585521?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228171168585521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228171168585521' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228171168585521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228171168585521'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/benchmarks-for-movie-recording.html' title='benchmarks for movie recording'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228167147968843</id><published>2005-10-01T00:00:00.000-07:00</published><updated>2006-10-31T01:49:17.686-08:00</updated><title type='text'>glitch #1: Jeff &amp; Sean</title><content type='html'>Sean:&lt;br /&gt;&lt;br /&gt;1. Visible tearing of image: DirectX is supposed to care of this no?  Would full-screen mode affect it?  Possibly affected by frame rate and CPU loading.&lt;br /&gt;&lt;br /&gt;2. Should sync to beat automatically.&lt;br /&gt;&lt;br /&gt;3. Should support multiple trackballs and other input devices at once.&lt;br /&gt;&lt;br /&gt;Jeff:&lt;br /&gt;&lt;br /&gt;1. Support for MIDI notes would be helpful since he's using an Oxygen 8.  Notes could act as toggles for the function keys.&lt;br /&gt;&lt;br /&gt;2. Tempo nudge should NOT resync, or at least there should be an alternate nudge that doesn't resync.  Sean agrees.&lt;br /&gt;&lt;br /&gt;3. Rotation of the entire image (as opposed to rotate speed), especially via MIDI.&lt;br /&gt;&lt;br /&gt;4. Zoom should go further out: can do this with MIDI.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228167147968843?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228167147968843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228167147968843' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228167147968843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228167147968843'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/10/glitch-1-jeff-sean.html' title='glitch #1: Jeff &amp; Sean'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228163503761306</id><published>2005-09-28T00:00:00.000-07:00</published><updated>2006-10-31T01:49:01.766-08:00</updated><title type='text'>movie disk requirements</title><content type='html'>The data rate of a WHM movie file is linearly proportional to scene complexity (as measured by ring count), and is also affected by the frame rate. Typical data rates range from .4 - 3.0 MBytes @ second, which means a 1-hour recording can require anywhere from 1.5 to 10 GB.&lt;br /&gt;&lt;br /&gt;Both ATA 100 and Firewire A can sustain write data rates of at least 30 MB @ second, with minimal CPU loading, so performance probably isn't an issue. Disk space could be an issue, particularly on older machines.&lt;br /&gt;&lt;br /&gt;Using WinZip on a WHM file typically yields a 60% - 70% size reduction. Recording to a compressed folder yields a 40% - 60% reduction, but causes the display to freeze at regular intervals on a PIII machine. The Gnu zlib compression library might have less impact, but some increase in CPU load is inevitable. To reduce disk usage, it might make sense to compress WHM files after recording. The app could include an option that does this automatically, but it would have to be done from a separate low-priority thread, and even then performance might be affected by context switching.&lt;br /&gt;&lt;br /&gt;A higher-order solution would record user input instead of recording ring data. This would reduce the data rate to a negligible amount, but at the expense of greatly increased complexity and fragility. This method should be explored for a future version.&lt;br /&gt;&lt;br /&gt;A very rough estimate of the data rate resulting from input recording:&lt;br /&gt;&lt;br /&gt;Record cursor delta for every frame: 8 bytes (2 ints) @ frame&lt;br /&gt;Record 16 MIDI controllers for every frame (worst case): 48 bytes @ frame&lt;br /&gt;Keyboard commands are too infrequent to affect the estimate&lt;br /&gt;8 + 48 = 56 bytes per frame; at 30 FPS, 56 * 30 = 1680 bytes @ second&lt;br /&gt;That's 6MB per hour in the absolute worst case&lt;br /&gt;&lt;br /&gt;Some benchmarks:&lt;br /&gt;&lt;br /&gt;Uncompressed 1024 x 768 video at 30 FPS: 70.5 MB @ sec&lt;br /&gt;Lotus light, speed around 700, 30 FPS, 1 minute = 131 MB (2.2 MB @ sec)&lt;br /&gt;Cross, speed around 700, 30 FPS, 1:36 = 80 MB (.83 MB @ sec)&lt;br /&gt;Kaleid, speed around 700, 30 FPS, 1:36 = 282 MB (2.9 MB @ sec)&lt;br /&gt;&lt;br /&gt;Another interesting possibility: Recording the view's oscillators and STATE member but not the rings, and then regenerating the rings on playback/export&lt;br /&gt;&lt;br /&gt;1 oscillator = 44 bytes * 16 = 704 bytes @ frame&lt;br /&gt;view STATE member = 104 bytes + 704 = 808 bytes @ frame&lt;br /&gt;call it 1K bytes @ frame, at 30 FPS = 30K bytes @ second (108 MB @ hour)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228163503761306?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228163503761306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228163503761306' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228163503761306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228163503761306'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/09/movie-disk-requirements.html' title='movie disk requirements'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228160072425541</id><published>2005-09-22T23:59:00.000-07:00</published><updated>2006-10-31T01:48:47.846-08:00</updated><title type='text'>making a WMV-9 DVD</title><content type='html'>Toshi says no need to change frame rate for WMV; between 5 and 20 MBits per sec should be good, and 1024 x 768 is fine.  Must compress the bitmaps first to make enough room to create an AVI, expect on the order of 75% compression overall.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228160072425541?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228160072425541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228160072425541' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228160072425541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228160072425541'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/09/making-wmv-9-dvd.html' title='making a WMV-9 DVD'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228157509507787</id><published>2005-09-12T23:58:00.000-07:00</published><updated>2006-10-31T01:58:26.106-08:00</updated><title type='text'>additional MIDI control</title><content type='html'>on/off: mirror, fill, outline, xray, invert hue, invert fill, invert outline, invert xray, rotate hue, reverse&lt;br /&gt;&lt;br /&gt;zoom should be damped, no?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228157509507787?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228157509507787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228157509507787' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228157509507787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228157509507787'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/09/additional-midi-control.html' title='additional MIDI control'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228151425511124</id><published>2005-09-10T23:57:00.000-07:00</published><updated>2006-10-31T02:01:34.336-08:00</updated><title type='text'>show size in status bar message while resizing</title><content type='html'>You must handle WM_ENTERSIZEMOVE and wM_EXITSIZEMOVE to show the initial size and restore the default message.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;LRESULT CMainFrame::OnEnterSizeMove(WPARAM wParam, LPARAM lParam)&lt;br /&gt;{&lt;br /&gt;    CRect   r;&lt;br /&gt;    m_View-&gt;GetClientRect(r);&lt;br /&gt;    CString s;&lt;br /&gt;    s.Format("%d x %d\n", r.Width(), r.Height());&lt;br /&gt;    SetMessageText(s);  // must do all the above in OnSize too, but only if window is visible&lt;br /&gt;    return(TRUE);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;LRESULT CMainFrame::OnExitSizeMove(WPARAM wParam, LPARAM lParam)&lt;br /&gt;{&lt;br /&gt;    SetMessageText(AFX_IDS_IDLEMESSAGE);&lt;br /&gt;    return(TRUE);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that this only works if the system property "show window contents while dragging" is set.  Otherwise you only see the initial size, because WM_SIZE isn't sent until the drag ends.  WM_SIZING *is* sent, but it doesn't help, because it passes us the size of the frame, whereas we want the size of the view.  Oddly, there seems to be no way to determine the client area that would result from a given window size.  CalcWindowRect does the reverse: it gives us the size of the window needed for a given client area.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228151425511124?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228151425511124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228151425511124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228151425511124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228151425511124'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/09/show-size-in-status-bar-message-while.html' title='show size in status bar message while resizing'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228143855577768</id><published>2005-09-06T23:56:00.000-07:00</published><updated>2006-10-31T02:02:09.656-08:00</updated><title type='text'>CalcWindowRect bug</title><content type='html'>This bug first appeared during the development of movie export.  Moving the export to a separate process made it go away, but now it's back in version 1.0.73.  Most likely the AVI file DLL was falsely accused and the movie export could have been part of the main app, but that's a secondary issue.&lt;br /&gt;&lt;br /&gt;The symptom is, the app crashes in RowDialogForm's CalcWindowRect during the construction of the Parms dialog.  It doesn't crash in debug, only in release, and creating a console window makes it go away (great!).  Deleting the unused m_Template member variable from CPersistDlg.h also makes it go away.  This last symptom clearly points towards a memory corruption problem of some kind.  In the release debugger, the problem begins when CRowDialog::OnInitDialog calls CViewDialog::OnInitDialog.  After this call, CRowDialog's "this" and HWND are trashed.  Note that neither CViewDialog nor its immediate base class (CPersistDlg) override OnInitDialog, so this is effectively a call to CDialog::OnInitDialog.&lt;br /&gt;&lt;br /&gt;Removing the call to MakeVJAccelTable in CMainFrame's ctor also makes it go away.&lt;br /&gt;&lt;br /&gt;The really bad news: the app only crashes when you execute it from the IDE; running from Explorer is OK.&lt;br /&gt;&lt;br /&gt;Other observations:&lt;br /&gt;in Frame's ctor list, m_ResultsDlg(m_View), is incorrect initialization, m_View isn't the dialog's parent and in any case it's NULL! deleting this line doesn't help though...&lt;br /&gt;&lt;br /&gt;could be passing 'this' to dialogs isn't such a good idea after all, seems like CMainFrame's 'this' keeps changing somehow or is that just the debugger being bad in release mode?&lt;br /&gt;&lt;br /&gt;The solution: in CalcWindowRect, casting GetParent() down to CRowDialog isn't always correct.  Initially, the parent is the dummy frame, not CRowDialog.  Use a dynamic downcast to determine the parent.&lt;br /&gt;&lt;br /&gt;The moral of the story: Downcasting is dangerous so use dynamic downcast and verify the result!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228143855577768?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228143855577768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228143855577768' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228143855577768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228143855577768'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/09/calcwindowrect-bug.html' title='CalcWindowRect bug'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228139964264062</id><published>2005-08-29T23:56:00.000-07:00</published><updated>2006-10-31T02:02:24.490-08:00</updated><title type='text'>movies</title><content type='html'>pjbmp2avi.exe seems to work fine, with the CinePack codec at 100% (default) it's about 11MB for 36 seconds.&lt;br /&gt;&lt;br /&gt;Storing snapshots with window size at 720x480 (DVD fullscreen) yields 80K snaps on average, with no appreciable slowdown: 80 * 25 * 60 = 120MB @ minute.  This seems better than storing bitmaps.&lt;br /&gt;&lt;br /&gt;Actual date rate test: demo speed = 975, 18.4 minutes, size 1.256 GB, rate = 73MB @ minute&lt;br /&gt;&lt;br /&gt;Random waveform bug can be demonstrated using new OscTest, settings: random, .01, .5, .05, .1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228139964264062?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228139964264062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228139964264062' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228139964264062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228139964264062'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/movies.html' title='movies'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228137036820157</id><published>2005-08-28T23:55:00.000-07:00</published><updated>2006-10-31T02:07:52.130-08:00</updated><title type='text'>almost there</title><content type='html'>During crossfade, random waveform's frequency change glitches horribly, fix this.  Also fix a minor glitch when patch is switched without crossfade: in this case clear the view's previous parameter info to prevent interpolation. Ring growth and master speed glitch too but it's less noticeable.&lt;br /&gt;&lt;br /&gt;Overall it looks gorgeous and feels incredibly powerful and exciting, it's a different whorld.  Master speed of 901 is very nice, maybe use this speed for demo?  Maybe a bit too fast, 603 is good too...&lt;br /&gt;&lt;br /&gt;Random waveform bug can be demonstrated using new OscTest, settings: random, .01, .5, .05, .1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228137036820157?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228137036820157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228137036820157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228137036820157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228137036820157'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/almost-there.html' title='almost there'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228134703777338</id><published>2005-08-27T23:55:00.000-07:00</published><updated>2006-10-31T02:08:05.606-08:00</updated><title type='text'>more on clumping</title><content type='html'>oscillator must move into view so it can be subclocked (non-integer clock increments).  See 1.0.69c.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228134703777338?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228134703777338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228134703777338' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228134703777338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228134703777338'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/more-on-clumping.html' title='more on clumping'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228131564453973</id><published>2005-08-24T23:54:00.000-07:00</published><updated>2006-10-31T02:02:40.220-08:00</updated><title type='text'>clumping</title><content type='html'>The clumping problem goes all the way back to the beginning.  It occurs when master speed and/or ring growth) are big enough to cause multiple rings per timer tick.  When the view's timer hook adds multiple rings, the rings all share the same properties, which causes those rings to form an easily distinguishable group or "clump".&lt;br /&gt;&lt;br /&gt;The worst offenders are rotation and skew (AKA shift).  Both of these are zeroed at birth, and then incremented by the view's draw function.  A major reduction of clumping can be obtained simply by offsetting each ring's initial rotation and skew.  The offset is a delta multiplied by a fraction.  The fraction is calculated by dividing the ring's index by the total number of rings that will be born for this timer tick.  If four rings will be born, the fractions for the rings will be 0, .25, .5, and .75 respectively, and if the current rotation delta is .2, the initial rotations for the rings will be 0 * .2, .25 * .2, .5 * .2, and .75 * .2.&lt;br /&gt;&lt;br /&gt;The only complication is that the rings are generated in reverse order.  This means the indices have to be inverted, e.g. by using (count - 1 - i) instead of i, which means the count must be computed before the ring-adding loop begins.  The count can be computed as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int(m_st.RingOffset / m_Parms.RingSpacing) + 1;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Also note that the resulting offsets must be multiplied by RingGrowth to be effective.&lt;br /&gt;&lt;br /&gt;The next-worst offenders are the LFOs.  The LFOs are outside the view, but they only modify the view parameters on timer tick boundaries.  This means that any LFO has the potential to cause clumping.  The high road would move the oscillators into the view but this is a drastic change and has many side effects.  The low road is to interpolate between the current and previous parameter values.  In practice interpolation seems to work very well for all parameters except ring growth and ring sides.  The view timer hook must calculate a delta between each parameter's current and previous values, like so:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for (int j = 0; j &lt; 16; j++)&lt;br /&gt;    delta[j] = (((double *)&amp;prevparm)[j] - ((double *)&amp;m_Parms)[j]) / count;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And then within the ring-adding loop, overwrite m_Parms with interpolated values:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for (j = 0; j &lt; 16; j++)    // NOTE: don't do this to ring growth or # sides&lt;br /&gt;    ((double *)&amp;m_Parms)[j] = ((double *)&amp;prevparm)[j] + delta[j] * (count - 1 - i);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And finally, restore m_Parms.&lt;br /&gt;&lt;br /&gt;Interestingly, this seems to work perfectly with sine LFOs, but exhibits a noticeable periodic discontinuity with triangle LFOs.  This seems to indicate an undiscovered problem with the above method, or possibly a bug in the oscillator object.&lt;br /&gt;&lt;br /&gt;The final offender is the ring color.  This is calculated in the view's timer hook, which means all the rings in a group will have the exact same color.  This can probably be solved by interpolation as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228131564453973?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228131564453973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228131564453973' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228131564453973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228131564453973'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/clumping.html' title='clumping'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228124460130050</id><published>2005-08-18T23:53:00.000-07:00</published><updated>2006-10-31T02:08:44.546-08:00</updated><title type='text'>front page image</title><content type='html'>1896x1038x72&lt;br /&gt;canvas size to 1280x700&lt;br /&gt;save for web at 50% jpeg high&lt;br /&gt;result 640x350 +/- 35K&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228124460130050?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228124460130050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228124460130050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228124460130050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228124460130050'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/front-page-image.html' title='front page image'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228121745273235</id><published>2005-08-06T23:52:00.001-07:00</published><updated>2006-10-31T02:03:05.170-08:00</updated><title type='text'>reverse and per-ring draw mode</title><content type='html'>In reverse, innermost ring fill test must be steps &lt; minimum size AND steps &lt; previous radius.  This prevents possible holes when switching from forward to reverse, e.g. in lotus light.&lt;br /&gt;&lt;br /&gt;The new freedoms must have a price, let's see:&lt;br /&gt;&lt;br /&gt;250 iters of default patch, total time spent in Draw:&lt;br /&gt;&lt;br /&gt;1.0.64:&lt;br /&gt;.2269&lt;br /&gt;.2237&lt;br /&gt;.2263&lt;br /&gt;.2251&lt;br /&gt;AVG=.2255&lt;br /&gt;&lt;br /&gt;1.0.63:&lt;br /&gt;.2256&lt;br /&gt;.2255&lt;br /&gt;.2271&lt;br /&gt;.2273&lt;br /&gt;AVG=.2263&lt;br /&gt;&lt;br /&gt;It got faster?  Not likely.  Try again using 250 iters of Pinwheel No Rand:&lt;br /&gt;&lt;br /&gt;1.0.64&lt;br /&gt;.5856&lt;br /&gt;.5863&lt;br /&gt;.5852&lt;br /&gt;.5857&lt;br /&gt;AVG=.5857&lt;br /&gt;&lt;br /&gt;1.0.63&lt;br /&gt;.5876&lt;br /&gt;.5854&lt;br /&gt;.5850&lt;br /&gt;.5874&lt;br /&gt;AVG=.5863&lt;br /&gt;&lt;br /&gt;Very strange.  Try a longer test?  1000 iters, window maximized, Pinwheel no rand with Ring Growth = 3 and Canvas Size = 300:&lt;br /&gt;&lt;br /&gt;1.0.64&lt;br /&gt;17.779&lt;br /&gt;17.784&lt;br /&gt;17.770&lt;br /&gt;17.762&lt;br /&gt;&lt;br /&gt;1.0.63&lt;br /&gt;17.780&lt;br /&gt;17.780&lt;br /&gt;17.797&lt;br /&gt;&lt;br /&gt;1.0.61 (no reverse or per-ring draw at all)&lt;br /&gt;17.789&lt;br /&gt;17.776&lt;br /&gt;17.793&lt;br /&gt;&lt;br /&gt;Well, somehow it got faster...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228121745273235?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228121745273235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228121745273235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228121745273235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228121745273235'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/reverse-and-per-ring-draw-mode.html' title='reverse and per-ring draw mode'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228117634048710</id><published>2005-08-06T23:52:00.000-07:00</published><updated>2006-10-31T02:03:16.350-08:00</updated><title type='text'>mouse sensitivity</title><content type='html'>Overall much better now that ranges are correctly accounted for.&lt;br /&gt;Speed, zoom and hue all feel about the same.&lt;br /&gt;&lt;br /&gt;Trackball is too twitchy at sensitivity = 100%, it feels best around 65%.&lt;br /&gt;Maybe nominals should be lower?  Try some other devices and average the results.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228117634048710?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228117634048710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228117634048710' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228117634048710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228117634048710'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/08/mouse-sensitivity.html' title='mouse sensitivity'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228115371560631</id><published>2005-07-23T23:52:00.000-07:00</published><updated>2006-10-31T02:03:27.923-08:00</updated><title type='text'>edit slider</title><content type='html'>can be used in:&lt;br /&gt;x-fader dialog, for pos&lt;br /&gt;row dialog? for val&lt;br /&gt;master dialog, for all except damping?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228115371560631?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228115371560631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228115371560631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228115371560631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228115371560631'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/edit-slider.html' title='edit slider'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228112003609508</id><published>2005-07-22T23:51:00.000-07:00</published><updated>2006-10-31T02:04:14.673-08:00</updated><title type='text'>line width: DC pen optimization</title><content type='html'>Don't re-select the DC pen when it's already selected: the GetStockObject and SelectObject calls are considerably more expensive than the test that avoids them.&lt;br /&gt;&lt;br /&gt;Benchmark comparing wide-line version to original (default patch, total time spent in Draw function, 1000 calls) reveals that the wide-line version takes 0.06% longer:&lt;br /&gt;&lt;br /&gt;old way:&lt;br /&gt;1.3425&lt;br /&gt;1.3459&lt;br /&gt;1.3457&lt;br /&gt;1.3393&lt;br /&gt;1.3419&lt;br /&gt;1.3411&lt;br /&gt;1.3449&lt;br /&gt;AVG = 1.3430&lt;br /&gt;&lt;br /&gt;new way:&lt;br /&gt;1.3433&lt;br /&gt;1.3453&lt;br /&gt;1.3428&lt;br /&gt;1.3405&lt;br /&gt;1.3467&lt;br /&gt;1.3431&lt;br /&gt;1.3456&lt;br /&gt;AVG = 1.3439&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include "benchmark.h"&lt;br /&gt;#define MAXSAMPS 1000&lt;br /&gt;double  samp[MAXSAMPS];&lt;br /&gt;int samps;&lt;br /&gt;bool done;&lt;br /&gt;void  CWhorldView::Draw(HDC dc)&lt;br /&gt;{&lt;br /&gt;Benchmark b;&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;if (samps &lt; MAXSAMPS) {&lt;br /&gt;    samp[samps++] = b.Elapsed();&lt;br /&gt;} else {&lt;br /&gt;    if (!done) {&lt;br /&gt;        FILE *fp = fopen("test.txt", "w");&lt;br /&gt;        double  sum = 0;&lt;br /&gt;        for (int i = 0; i &lt; samps; i++) {&lt;br /&gt;            fprintf(fp, "%f\n", samp[i]);&lt;br /&gt;            sum += samp[i];&lt;br /&gt;        }&lt;br /&gt;        fclose(fp);&lt;br /&gt;        done = 1;&lt;br /&gt;        CString s;&lt;br /&gt;        s.Format("%f", sum);&lt;br /&gt;        AfxMessageBox(s);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;another test, using Pinwheel but with # sides set to 20 and no LFO, 2500 samples&lt;br /&gt;&lt;br /&gt;new 21.6328&lt;br /&gt;old 21.5634&lt;br /&gt;0.32% slower&lt;br /&gt;&lt;br /&gt;again:&lt;br /&gt;new 21.6226&lt;br /&gt;old 21.5317&lt;br /&gt;0.42% slower&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228112003609508?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228112003609508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228112003609508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228112003609508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228112003609508'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/line-width-dc-pen-optimization.html' title='line width: DC pen optimization'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228099363170505</id><published>2005-07-22T23:49:00.000-07:00</published><updated>2006-10-31T02:04:31.690-08:00</updated><title type='text'>line width</title><content type='html'>creating a 1-pixel wide CPen and selecting it takes 85 micros (avg)&lt;br /&gt;best case is around 8 micros, worst case is 850 to nearly 1000 (!)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;m_Pen.DeleteObject();&lt;br /&gt;m_Pen.CreatePen(PS_SOLID, 1, rp.Color);&lt;br /&gt;SelectObject(dc, m_Pen);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;setting DC pen color and selecting DC pen takes 2 micros (avg)&lt;br /&gt;best case is 1 micro, worst case is 5&lt;br /&gt;&lt;br /&gt;CPen way is anywhere from 2 to 1000 times slower&lt;br /&gt;it's worth it to branch if you plan on doing a lot of 1-pixel wide lines&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228099363170505?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228099363170505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228099363170505' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228099363170505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228099363170505'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/line-width.html' title='line width'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228095364923057</id><published>2005-07-20T23:48:00.000-07:00</published><updated>2006-10-31T02:04:50.770-08:00</updated><title type='text'>lotus cross</title><content type='html'>lotus cross looks cool with these master settings:&lt;br /&gt;speed 458&lt;br /&gt;zoom 54&lt;br /&gt;damping 51&lt;br /&gt;tempo 20&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228095364923057?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228095364923057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228095364923057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228095364923057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228095364923057'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/lotus-cross.html' title='lotus cross'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228090729203966</id><published>2005-07-18T23:47:00.000-07:00</published><updated>2006-10-31T02:05:08.943-08:00</updated><title type='text'>Alt (menu) key</title><content type='html'>&lt;pre&gt;&lt;br /&gt;BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) &lt;br /&gt;{&lt;br /&gt;    // in full screen mode, ignore the Menu key, so we don't go modal&lt;br /&gt;    if (pMsg-&gt;message == WM_SYSKEYDOWN &amp;&amp; pMsg-&gt;wParam == VK_MENU &amp;&amp; m_IsFullScreen)&lt;br /&gt;        return(TRUE);&lt;br /&gt;    return CFrameWnd::PreTranslateMessage(pMsg);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228090729203966?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228090729203966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228090729203966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228090729203966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228090729203966'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/alt-menu-key.html' title='Alt (menu) key'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228084159603136</id><published>2005-07-08T23:46:00.000-07:00</published><updated>2006-10-31T02:05:20.506-08:00</updated><title type='text'>zoom</title><content type='html'>zoom can position origin off-canvas, resulting in no rings&lt;br /&gt;&lt;br /&gt;in SetNormOrigin, must clamp:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    m_Origin.x = CLAMP(round(m_Size.cx * m_st.NormOrg.x), m_Canvas.left, m_Canvas.right - 1);&lt;br /&gt;    m_Origin.y = CLAMP(round(m_Size.cy * m_st.NormOrg.y), m_Canvas.top, m_Canvas.bottom - 1);&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228084159603136?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228084159603136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228084159603136' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228084159603136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228084159603136'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/zoom.html' title='zoom'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228081426574750</id><published>2005-07-05T23:46:00.000-07:00</published><updated>2006-10-31T02:05:51.623-08:00</updated><title type='text'>Optimizing message order in a message map is useless</title><content type='html'>MFC caches the most frequently used messages anyway, to avoid repeated table searching.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228081426574750?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228081426574750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228081426574750' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228081426574750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228081426574750'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/optimizing-message-order-in-message.html' title='Optimizing message order in a message map is useless'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228067627509394</id><published>2005-07-02T23:44:00.000-07:00</published><updated>2006-10-31T02:06:04.973-08:00</updated><title type='text'>mouse damping</title><content type='html'>Zone rings does damping from the timer hook:  It repeatedly computes the difference between the origin and the mouse cursor, multiplies the difference by a normalized damping  factor, and adds the result to the origin.  The damping factor ranges from 0..1, 0 = maximum damping, 1 = no damping.  At damping = 1, the result is always equal to the entire distance between origin and cursor, so the origin jumps immediately to the cursor position.  At damping = 0, the origin would never move at all.  Maybe the damping factor is kept above zero to prevent this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228067627509394?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228067627509394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228067627509394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228067627509394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228067627509394'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/07/mouse-damping.html' title='mouse damping'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228061479173212</id><published>2005-06-25T23:42:00.000-07:00</published><updated>2006-10-31T02:06:20.976-08:00</updated><title type='text'>mercedes lissajous</title><content type='html'>mercedes looks good with these lissajous values:&lt;br /&gt;&lt;br /&gt;delta .01&lt;br /&gt;delta2 .02&lt;br /&gt;phasedelta .0211&lt;br /&gt;rad .25&lt;br /&gt;origin .35&lt;br /&gt;bit too fast though...&lt;br /&gt;&lt;br /&gt;also nice colorspeed effect:&lt;br /&gt;colorspeed 3.39 pulse wave amp = 2 freq = .05 pw = .333&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228061479173212?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228061479173212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228061479173212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228061479173212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228061479173212'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/06/mercedes-lissajous.html' title='mercedes lissajous'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116228050311635584</id><published>2005-06-25T23:40:00.000-07:00</published><updated>2006-10-31T02:06:34.526-08:00</updated><title type='text'>lissajous origin</title><content type='html'>constant phase difference: affects width of oval, difference of PI/2 gives a line&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;linear phase difference change:&lt;br /&gt;&lt;br /&gt;x = sin(theta + phasetheta);&lt;br /&gt;y = cos(theta)&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;x = sin(thetax);&lt;br /&gt;y = cos(thetay);&lt;br /&gt;&lt;br /&gt;are equivalent forms, assuming thetax has a different delta than thetay.  What's important is the *ratio* of theta to phasetheta (or thetax to thetay).  When the ratio is a simple fraction, the shape is simple and predictable; ratios that aren't simple fractions (e.g. .51) tend to produce elaborate net-like shapes.&lt;br /&gt;&lt;br /&gt;trig phase difference change:&lt;br /&gt;&lt;br /&gt;x = sin(theta)&lt;br /&gt;y = cos(theta + sin(phasetheta));&lt;br /&gt;&lt;br /&gt;Again, it's the ratio between the deltas that matters.  Incrementing theta by .1 and phasetheta by .01 will have the same effect as .2 and .02.&lt;br /&gt;&lt;br /&gt;original:&lt;br /&gt;    static double rad = .25;        &lt;br /&gt;    double ox = sin(theta + sin(phasetheta) + i);&lt;br /&gt;    double oy = cos(theta2);&lt;br /&gt;    m_View-&gt;SetNormOrigin(ox * rad +.35, oy * rad +.35, FALSE);&lt;br /&gt;    theta += .01;&lt;br /&gt;    theta2 += .02;&lt;br /&gt;    phasetheta += .0311;&lt;br /&gt;&lt;br /&gt;slower and better:&lt;br /&gt;    static double rad = .25;&lt;br /&gt;    double ox = sin(theta + sin(phasetheta));&lt;br /&gt;    double oy = cos(theta2);&lt;br /&gt;    m_View-&gt;SetNormOrigin(ox * rad +.35, oy * rad +.35, FALSE);&lt;br /&gt;    theta += .001;&lt;br /&gt;    theta2 += .002;&lt;br /&gt;    phasetheta += .00211;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116228050311635584?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116228050311635584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116228050311635584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228050311635584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116228050311635584'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/06/lissajous-origin.html' title='lissajous origin'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116227609488633604</id><published>2005-04-30T22:27:00.000-07:00</published><updated>2006-10-31T02:06:51.073-08:00</updated><title type='text'>demo crossfade</title><content type='html'>randomize phase of parms whose frequency goes from zero to nonzero first, in A and B if freq AND amp are zero, set freq to 1e-6 so phase change will stick&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for (int i = 0; i &lt; ROWS; i++) {&lt;br /&gt;    if (!m_CrossDlg.GetInfo(reverse ? CCrossDlg::SEL_B : CCrossDlg::SEL_A).m_Row[i].ModFreq&lt;br /&gt;        &amp;&amp; m_CrossDlg.GetInfo(reverse ? CCrossDlg::SEL_A : CCrossDlg::SEL_B).m_Row[i].ModFreq) {&lt;br /&gt;        m_Osc[i].SetPhase(double(rand()) / RAND_MAX);&lt;br /&gt;        printf("randomized %s\n", ParmInfo::GetRowData(i).Name);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116227609488633604?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116227609488633604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116227609488633604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116227609488633604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116227609488633604'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/04/demo-crossfade.html' title='demo crossfade'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36878330.post-116227994723399921</id><published>2005-04-22T23:28:00.000-07:00</published><updated>2006-10-31T02:07:04.456-08:00</updated><title type='text'>corrected ring deletion: cascade delete</title><content type='html'>In previous versions, deleting a ring also deleted all subsequent rings in the list. This was only perceptible when the erroneously deleted rings happened to be visible. This situation occurs in certain demo patches which use a large star factor.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;demo patches affected:&lt;br /&gt;&lt;br /&gt;drastic change:&lt;br /&gt;cross   Y   totally different; occasional nice moire but mostly too cluttered&lt;br /&gt;lotus light Y   rings persist too long and spoil the drama&lt;br /&gt;mercedes    Y   rings persist too long and spoil the drama&lt;br /&gt;&lt;br /&gt;slight change:&lt;br /&gt;pinwheel fab color  Y   "tunnel" state clears differently, but it's fine&lt;br /&gt;pinwheel    Y   occasional very slight difference at edges&lt;br /&gt;shimmer Y   occasional slight difference at edges&lt;br /&gt;tentacles   Y   slight difference: occasional stray threads hang around&lt;br /&gt;&lt;br /&gt;no change:&lt;br /&gt;good2   N   no difference&lt;br /&gt;kaleid  N   no difference&lt;br /&gt;real pinwheel   N   no difference&lt;br /&gt;&lt;br /&gt;"all at once" cascade:&lt;br /&gt;        m_Ring.RemoveAt(CurPos);&lt;br /&gt;        while (NextPos != NULL) {   // delete remaining rings&lt;br /&gt;            CurPos = NextPos;&lt;br /&gt;            m_Ring.GetNext(NextPos);&lt;br /&gt;            m_Ring.RemoveAt(CurPos);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;gradual cascade, similar to original behavior, but smoother:&lt;br /&gt;    POSITION DelPos = NULL&lt;br /&gt;// main loop&lt;br /&gt;        m_Ring.RemoveAt(CurPos);&lt;br /&gt;        DelPos = NextPos;   // start cascade delete&lt;br /&gt;// end of main loop&lt;br /&gt;    if (DelPos != NULL) {&lt;br /&gt;        RING&amp;   rp = m_Ring.GetNext(DelPos);&lt;br /&gt;        rp.Steps = 1e9; // mark ring for deletion&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36878330-116227994723399921?l=whorld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://whorld.blogspot.com/feeds/116227994723399921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36878330&amp;postID=116227994723399921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116227994723399921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36878330/posts/default/116227994723399921'/><link rel='alternate' type='text/html' href='http://whorld.blogspot.com/2005/04/corrected-ring-deletion-cascade-delete.html' title='corrected ring deletion: cascade delete'/><author><name>Chris Korda</name><uri>http://www.blogger.com/profile/01929043998111578392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_M1A03HK39aM/S1QN04LDYpI/AAAAAAAAAAM/D-jzPBLUQzo/S220/ck-head-shot-psych2b.jpg'/></author><thr:total>0</thr:total></entry></feed>
