<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Tutorials</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>Recent changes to Tutorials</description><atom:link href="https://sourceforge.net/p/ogl4net/wiki/Tutorials/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 21 Jan 2013 10:18:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ogl4net/wiki/Tutorials/feed" rel="self" type="application/rss+xml"/><item><title>Discussion for Tutorials page</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Yes, you are right, I just wanted to make the example as simple as possible, but this should be probably mentioned. Thank you.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Mon, 21 Jan 2013 10:18:01 -0000</pubDate><guid>https://sourceforge.netb3fee260aadac9b03fefaba1fea629487822a219</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -56,6 +56,20 @@
         }
 ~~~~

+- If you plan to allow the user to change the window size, you have to update the viewport size and probably make some changes in your projection matrix.
+
+~~~~
+    :::C#
+        protected override void OnSizeChanged(EventArgs e)
+        {
+            gl.Viewport(0,0,ClientSize.Width, ClientSize.Height);
+            // change projection matrix etc.
+        }
+
+~~~~
+
+
+
 - Finally, override the WndProc method and call Render method on WM_PAINT message

 ~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Mon, 21 Jan 2013 10:10:43 -0000</pubDate><guid>https://sourceforge.netb24c256461ff47a9e9e011514d1a0ce7e5396bc1</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Mon, 21 Jan 2013 10:04:55 -0000</pubDate><guid>https://sourceforge.net413acc19d4a6fccf48a6ee920bd24b31db854c16</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -31,13 +31,14 @@
         }
 ~~~~

-- Now create the Init function that creates the rendering context, using the form (this). 
+- Now create the Init function that creates the rendering context, using the form (this). To avoid flickering in some cases (e.g., changing the size), it is necessary to ignore the WM_ERASEBKGND message. This could be achieved by setting control style AllPaintingInWmPaint to true (or by ignoring WM_ERASEBKGND in WndProc method).

 ~~~~
     :::C#
         void Init()
         {
             rc = RenderingContext.CreateContext(this);
+            SetStyle (ControlStyles.AllPaintingInWmPaint, true);
         }
 ~~~~

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Mon, 21 Jan 2013 09:55:41 -0000</pubDate><guid>https://sourceforge.netc2e12d748b4063c8777a45de2714d8778ff6bc88</guid></item><item><title>Discussion for Tutorials page</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Yes, you are right, I just wanted to make the example as simple as possible, but this should be probably mentioned. Thank you.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Mon, 21 Jan 2013 09:49:20 -0000</pubDate><guid>https://sourceforge.net2be53ba8bdd807897d1b28a3e131939a9de82c81</guid></item><item><title>Discussion for Tutorials page</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;You may have to call Render() for WM_ERASEBKGND (0x0014) too. If your window has FormBorderStyle of Sizable then you'll need to watch for WM_SIZE (0x0005) messages and update your gl.Viewport accordingly.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jwr</dc:creator><pubDate>Sun, 20 Jan 2013 07:19:16 -0000</pubDate><guid>https://sourceforge.netbb47dee0bac386e3518524d31e732b562ede97e7</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -9,7 +9,7 @@
     :::C#
     using System;
     using System.Windows.Forms;
-    using OpenGL;
+    using OpenGL4Net;
 ~~~~
 
 - It is easier to inherit your class from System.Windows.Forms.Form.
@@ -69,5 +69,5 @@
         }
 
     }
-}
+
 ~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Wed, 12 Dec 2012 06:11:39 -0000</pubDate><guid>https://sourceforge.netfa15fc0365485d2e1d8d83f81d1e8d86a482d4d8</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -14,7 +14,7 @@
 
 - It is easier to inherit your class from System.Windows.Forms.Form.
 - Add the RenderingContext as a class variable.
-- Create the Main function that create an instance of your form, calls the Init function and starts the application with Application.Run method.
+- Create the Main function that creates an instance of your form, calls the Init function and starts the application with Application.Run method.
 
 ~~~~
     :::C#
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Sun, 09 Dec 2012 21:13:16 -0000</pubDate><guid>https://sourceforge.net4ac7c248384aac924e10f0f2a2712553f95b8c8a</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -1,4 +1,5 @@
-*Creating OpenGL context*
+Creating OpenGL context
+=======================
 
 - Include references to System.Windows.Forms and System.Drawing.
 - Include a reference to OpenGL4Net.dll (IMPORTANT! 32 or 64 bit version according to your project properties) or add OpenGL4Net.cs to your project.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Sun, 09 Dec 2012 21:12:19 -0000</pubDate><guid>https://sourceforge.netc6bb52912499fc8d2ea949df6708f236643ecf97</guid></item><item><title>WikiPage Tutorials modified by pet_cz</title><link>https://sourceforge.net/p/ogl4net/wiki/Tutorials/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -5,30 +5,59 @@
 - Optionally use the "using" statement to shorten the syntax
 
 ~~~~
-!C#
-using System;
-using System.Windows.Forms;
-using OpenGL;
+    :::C#
+    using System;
+    using System.Windows.Forms;
+    using OpenGL;
 ~~~~
 
-namespace ShortestOpenGL
-{
+- It is easier to inherit your class from System.Windows.Forms.Form.
+- Add the RenderingContext as a class variable.
+- Create the Main function that create an instance of your form, calls the Init function and starts the application with Application.Run method.
+
+~~~~
+    :::C#
     class Program : Form
     {
         RenderingContext rc;
 
+
+        static void Main(string[] args)
+        {
+            Program program = new Program();
+            program.Init();
+            Application.Run(program);
+        }
+~~~~
+
+- Now create the Init function that creates the rendering context, using the form (this). 
+
+~~~~
+    :::C#
         void Init()
         {
             rc = RenderingContext.CreateContext(this);
         }
+~~~~
 
+- The Render method should clear the screen and swap front and back buffers
+
+~~~~
+    :::C#
         void Render()
         {
-            gl.ClearColor((float)Math.Sin(DateTime.Now.Ticks/5000000.0), 0, 0, 0);
             gl.Clear(GL.COLOR_BUFFER_BIT);
+
+            // here is the right place to draw all your scene
+
             rc.SwapBuffers();
         }
+~~~~
 
+- Finally, override the WndProc method and call Render method on WM_PAINT message
+
+~~~~
+    :::C#
         protected override void WndProc(ref Message m)
         {
             switch (m.Msg)
@@ -38,11 +67,6 @@
             }
         }
 
-        static void Main(string[] args)
-        {
-            Program program = new Program();
-            program.Init();
-            Application.Run(program);
-        }
     }
 }
+~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pet_cz</dc:creator><pubDate>Sun, 09 Dec 2012 21:06:09 -0000</pubDate><guid>https://sourceforge.net78772eb76dd3f509e684ff9e6dbeed0040097a3e</guid></item></channel></rss>