<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Animation in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Animation/m-p/968129#M23355</link>
    <description>Double-buffering improves the animation, surely. You should use: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt; 
hBufferDC = CreateCompatibleDC(hWindowDC, iWidth, iHeight) 
hBmp = CreateCompatibleBitmap(hWindowDC) 
iSt = SelectObject(hBufferDC, hBmp) 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;to create buffer DC. Your WM_PAINT handler should have, apart from &lt;BR /&gt;BeginPaint/EndPaint, only: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt; 
hDC = BeginPaint(hWnd, ps) 
iSt = BitBlt(hDC, ps%rcPaint%Left, ps%RcPaint%Top,  &amp;amp; 
ps%rcPaint%Right-ps%rcPaint%Left, ps%rcPaint%Bottom-ps%rcPaint%Top, &amp;amp; 
hBufferDC, ps%rcPaint%Left, ps%rcPaint%Top,SRCCOPY) 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;Always draw on hBufferDC and you can do it whenever you need update (not on WM_PAINT). Only ensure that you call InvalidateRect when you do the drawing.  &lt;BR /&gt;Of course, take care that of proper creation/destruction (DeleteDC) of hBufferDC -- usually, you create it only once and destroy it at program end. &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
    <pubDate>Wed, 19 Sep 2001 16:47:43 GMT</pubDate>
    <dc:creator>Jugoslav_Dujic</dc:creator>
    <dc:date>2001-09-19T16:47:43Z</dc:date>
    <item>
      <title>Animation</title>
      <link>https://community.intel.com/t5/Software-Archive/Animation/m-p/968125#M23351</link>
      <description>I am tring to animate graphics. When I run my program it executes the code but only the last frame shows up. There is a delay which I assume is because it is "drawing" the frames. So I must not be doing something that will update the window for each frame. &lt;BR /&gt; &lt;BR /&gt;Here is a portion of my code that does the animation. The routine gtest does the actual drawing of the frame. &lt;BR /&gt; &lt;BR /&gt;            case (IDM_GRAPH_CYCLE) &lt;BR /&gt;	do i=1,nhours &lt;BR /&gt;		pdate = dates1(nhours) &lt;BR /&gt;		ptime = times1(nhours) &lt;BR /&gt;		newdata = .true. &lt;BR /&gt;		call gtest (hWnd) &lt;BR /&gt;		retlog = UpdateWindow(hWnd) &lt;BR /&gt;		call sleep(100) &lt;BR /&gt;	enddo &lt;BR /&gt;	ret = InvalidateRect (hWnd, NULL_RECT, .TRUE.) &lt;BR /&gt;                MainWndProc = 0 &lt;BR /&gt;                return</description>
      <pubDate>Tue, 18 Sep 2001 01:24:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Animation/m-p/968125#M23351</guid>
      <dc:creator>bob_johnson</dc:creator>
      <dc:date>2001-09-18T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Animation</title>
      <link>https://community.intel.com/t5/Software-Archive/Animation/m-p/968126#M23352</link>
      <description>OK here is the code again. I hope it comes out better. &lt;BR /&gt; &lt;BR /&gt; &lt;PRE&gt; 
           case (IDM_GRAPH_CYCLE) 
	do i=1,nhours 
		pdate = dates1(nhours) 
		ptime = times1(nhours) 
		newdata = .true. 
		call gtest (hWnd) 
		retlog = UpdateWindow(hWnd) 
		call sleep(100) 
	enddo 
	ret = InvalidateRect (hWnd, NULL_RECT, .TRUE.) 
                MainWndProc = 0 
                return 
   
&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Sep 2001 01:30:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Animation/m-p/968126#M23352</guid>
      <dc:creator>bob_johnson</dc:creator>
      <dc:date>2001-09-18T01:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Animation</title>
      <link>https://community.intel.com/t5/Software-Archive/Animation/m-p/968127#M23353</link>
      <description>It's almost good -- you should move InvalidateRect &lt;B&gt;before&lt;/B&gt; UpdateWindow; UpdateWindow updates only if there's something to update -- you have to tell what it is with InvalildateRect.</description>
      <pubDate>Tue, 18 Sep 2001 17:17:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Animation/m-p/968127#M23353</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-09-18T17:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Animation</title>
      <link>https://community.intel.com/t5/Software-Archive/Animation/m-p/968128#M23354</link>
      <description>Jugoslav, &lt;BR /&gt; &lt;BR /&gt;That worked great !! It is now cycling through the frames. However it is not smooth. It shows each frame as it is drawn. Do I need to do some sort of double buffering ? If so how do I do that. Thanks</description>
      <pubDate>Wed, 19 Sep 2001 00:58:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Animation/m-p/968128#M23354</guid>
      <dc:creator>bob_johnson</dc:creator>
      <dc:date>2001-09-19T00:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Animation</title>
      <link>https://community.intel.com/t5/Software-Archive/Animation/m-p/968129#M23355</link>
      <description>Double-buffering improves the animation, surely. You should use: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt; 
hBufferDC = CreateCompatibleDC(hWindowDC, iWidth, iHeight) 
hBmp = CreateCompatibleBitmap(hWindowDC) 
iSt = SelectObject(hBufferDC, hBmp) 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;to create buffer DC. Your WM_PAINT handler should have, apart from &lt;BR /&gt;BeginPaint/EndPaint, only: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt; 
hDC = BeginPaint(hWnd, ps) 
iSt = BitBlt(hDC, ps%rcPaint%Left, ps%RcPaint%Top,  &amp;amp; 
ps%rcPaint%Right-ps%rcPaint%Left, ps%rcPaint%Bottom-ps%rcPaint%Top, &amp;amp; 
hBufferDC, ps%rcPaint%Left, ps%rcPaint%Top,SRCCOPY) 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;Always draw on hBufferDC and you can do it whenever you need update (not on WM_PAINT). Only ensure that you call InvalidateRect when you do the drawing.  &lt;BR /&gt;Of course, take care that of proper creation/destruction (DeleteDC) of hBufferDC -- usually, you create it only once and destroy it at program end. &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
      <pubDate>Wed, 19 Sep 2001 16:47:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Animation/m-p/968129#M23355</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-09-19T16:47:43Z</dc:date>
    </item>
  </channel>
</rss>

