title: Rendering OpenGL in WPF Application
body: <p>I try to create an WPF Application with an integrated OpenGL visualization. </p>
  
  <p>I found <a href="https://www.codeproject.com/Articles/3144/SharpGL-a-C-OpenGL-class-library" rel="nofollow noreferrer">the sample project SharpGL</a> it helped me to integrate the opengl code into my wpf program. </p>
  
  <p>now I just want to draw a rectangle which has the following attributes:</p>
  
  <pre><code>40 x coordinates = columns
  48 y coordinates = rows
  </code></pre>
  
  <p>Each (x,y) coordinate has a value which I have defined in an <code>List&lt;float&gt;</code>.
  The <code>List&lt;float&gt;</code> is dynamically, so it will change all the time. 
  The goal is too show the values in real time in the drawed rectangle. </p>
  
  <pre><code>Like:
            y-coord
  x coord   0  2  0  3  7  0  1  ..40
            4  5  3  0  6  0  5  ..40
            .  .
            .  .
            48 48
  </code></pre>
  
  <p>Unfortunately I fail already when I try to draw the rectangle. </p>
  
  <pre><code> private void openGLControl_OpenGLDraw(object sender, OpenGLEventArgs args)
      {
          //  Get the OpenGL object.
          OpenGL gl = openGLControl.OpenGL;
  
          //  Clear the color and depth buffer.
          gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT);
  
          //  Load the identity matrix.
          //gl.LoadIdentity();
          gl.PolygonMode(FaceMode.FrontAndBack, PolygonMode.Filled);
          gl.Color(0,0,0);
          //  Draw a coloured pyramid.
          gl.Begin(OpenGL.GL_QUADS);
          gl.Vertex(-1.0f, 1.0f);
          gl.Color(200,1,1);
          gl.Vertex(-1.0f, 0.0f);
          gl.Color(200, 1, 1);
          gl.Vertex(1.0f, 0.0f);
          gl.Color(200, 1, 1);
          gl.Vertex(1.0f, 1.0f);
          gl.Color(200, 1, 1);
          gl.End();
  
          //  Nudge the rotation.
          //rotation += 3.0f;
      }
  </code></pre>
  
  <p>My code shows just a black window.</p>
  
  <p>How could I realize that?</p>