Csharp Csgl error message

The following program is taken from  nehe tutorial C sharp using csgl.... It shows a error message in the statement
base.onsizechanged
could anyone solve this error
jsbsudhaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ikeworkCommented:
what error? can you paste it?
0
jsbsudhaAuthor Commented:
/* Lesson 05 of NeHe Productions in C#
   created by Sabine Felsinger*/

using System;
using System.Windows.Forms;
using System.Drawing;
using CsGL.OpenGL;

namespace lesson05
{
      public class OurView : OpenGLControl
      {
            public float rtri;                  // rtri is for rotating the pyramid
            public float rquad;                  // rquad is for rotating the quad

            public bool finished;

            public OurView() : base()
            {
                  this.KeyDown += new KeyEventHandler(OurView_OnKeyDown);
                  finished = false;
            }
            
            protected void OurView_OnKeyDown(object Sender, KeyEventArgs kea)
            {
                  //if escape was pressed exit the application
                  if (kea.KeyCode == Keys.Escape)
                  {
                        finished = true;
                  }
            }

            public override void glDraw()
            {
                  GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);      // Clear the Screen and the Depth Buffer
                  GL.glMatrixMode(GL.GL_MODELVIEW);            // Modelview Matrix
                  GL.glLoadIdentity();                              // reset the current modelview matrix
                  GL.glTranslatef(-1.5f,0.0f,-6.0f);            // move 1.5 Units left and 6 Units into the screen
                  GL.glRotatef(rtri,0.0f,1.0f,0.0f);            // rotate the Pyramid on it's Y-axis
                  rtri+=0.2f;                                                // rotation angle

                  GL.glBegin(GL.GL_TRIANGLES);                  // start drawing a triangle, always counterclockside (top-left-right)
                  GL.glColor3f(1.0f,0.0f,0.0f);                  // Red
                  GL.glVertex3f(0.0f,1.0f,0.0f);                  // Top of Triangle (Front)
                  GL.glColor3f(0.0f,1.0f,0.0f);                  // green
                  GL.glVertex3f(-1.0f,-1.0f,1.0f);            // left of Triangle (front)
                  GL.glColor3f(0.0f,0.0f,1.0f);                  // blue
                  GL.glVertex3f(1.0f,-1.0f,1.0f);                  // right of triangle (front)

                  GL.glColor3f(1.0f,0.0f,0.0f);                  // red
                  GL.glVertex3f(0.0f,1.0f,0.0f);                  // top of triangle (right)
                  GL.glColor3f(0.0f,0.0f,1.0f);                  // blue
                  GL.glVertex3f(1.0f,-1.0f,1.0f);                  // left of triangle (right)
                  GL.glColor3f(0.0f,1.0f,0.0f);                  // green
                  GL.glVertex3f(1.0f,-1.0f,-1.0f);            // right of triangel (right)

                  GL.glColor3f(1.0f,0.0f,0.0f);                  // red
                  GL.glVertex3f(0.0f,1.0f,0.0f);                  // top of triangle (back)
                  GL.glColor3f(0.0f,1.0f,0.0f);                  // green
                  GL.glVertex3f(1.0f,-1.0f,-1.0f);            // left of triangle (back)
                  GL.glColor3f(0.0f,0.0f,1.0f);                  // blue
                  GL.glVertex3f(-1.0f,-1.0f,-1.0f);            // right of triangle (back)

                  GL.glColor3f(1.0f,0.0f,0.0f);                  // red
                  GL.glVertex3f(0.0f,1.0f,0.0f);                  // top of triangle (left)
                  GL.glColor3f(0.0f,0.0f,1.0f);                  // blue
                  GL.glVertex3f(-1.0f,-1.0f,-1.0f);            // left of triangle (left)
                  GL.glColor3f(0.0f,1.0f,0.0f);                  // green
                  GL.glVertex3f(-1.0f,-1.0f,1.0f);            // right of triangle (left)
                  GL.glEnd();

                  GL.glLoadIdentity();                              // reset the current modelview matrix
            GL.glTranslatef(1.5f,0.0f,-7.0f);            // move 1.5 Units right and 7 into the screen
                  GL.glRotatef(rquad,1.0f,1.0f,1.0f);            // rotate the quad on the X,Y and Z-axis
                  rquad-=0.15f;                                          // rotation angle

                  GL.glBegin(GL.GL_QUADS);                        // start drawing a quad
                  GL.glColor3f(0.0f,1.0f,0.0f);                  // green top
                  GL.glVertex3f(1.0f,1.0f,-1.0f);                  // top right (top)
            GL.glVertex3f(-1.0f,1.0f,-1.0f);            // top left (top)
                  GL.glVertex3f(-1.0f,1.0f,1.0f);                  // bottom left (top)
                  GL.glVertex3f(1.0f,1.0f,1.0f);                  // bottom right (top)

                  GL.glColor3f(1.0f,0.5f,0.0f);                  // orange
                  GL.glVertex3f(1.0f,-1.0f,1.0f);                  // top right (bottom)
                  GL.glVertex3f(-1.0f,-1.0f,1.0f);            // top left (bottom)
                  GL.glVertex3f(-1.0f,-1.0f,-1.0f);            // bottom left (bottom)
                  GL.glVertex3f(1.0f,-1.0f,-1.0f);            // bottom right (bottom)

                  GL.glColor3f(1.0f,0.0f,0.0f);                  // red
                  GL.glVertex3f(1.0f,1.0f,1.0f);                  // top right (front)
                  GL.glVertex3f(-1.0f,1.0f,1.0f);                  // top left (front)
                  GL.glVertex3f(-1.0f,-1.0f,1.0f);            // bottom left (front)
                  GL.glVertex3f(1.0f,-1.0f,1.0f);                  // bottom right (front)

                  GL.glColor3f(1.0f,1.0f,0.0f);                        // yellow
                  GL.glVertex3f(-1.0f,1.0f,-1.0f);            // top right (back)
                  GL.glVertex3f(1.0f,1.0f,-1.0f);                  // top left (back)
                  GL.glVertex3f(1.0f,-1.0f,-1.0f);            // bottom left (back)
                  GL.glVertex3f(-1.0f,-1.0f,-1.0f);            // bottom right (back)
      
                  GL.glColor3f(0.0f,0.0f,1.0f);                  // blue
                  GL.glVertex3f(-1.0f,1.0f,1.0f);                  // top right (left)
                  GL.glVertex3f(-1.0f,1.0f,-1.0f);            // top left (left)
                  GL.glVertex3f(-1.0f,-1.0f,-1.0f);            // bottom left (left)
                  GL.glVertex3f(-1.0f,-1.0f,1.0f);            // bottom right (left)

                  GL.glColor3f(1.0f,0.0f,1.0f);                  // violett
                  GL.glVertex3f(1.0f,1.0f,-1.0f);                  // top right (right)
                  GL.glVertex3f(1.0f,1.0f,1.0f);                  // top left (right)
                  GL.glVertex3f(1.0f,-1.0f, 1.0f);            // bottom left (right)
                  GL.glVertex3f(1.0f,-1.0f,-1.0f);            // bottom right (right)
                  GL.glEnd();

            }

            protected override void InitGLContext()
            {
                  GL.glShadeModel(GL.GL_SMOOTH);                                                // enable smooth shading
                  GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);                              // black background
                  GL.glClearDepth(1.0f);                                                            // depth buffer setup
                  GL.glEnable(GL.GL_DEPTH_TEST);                                                // enables depth testing
                  GL.glDepthFunc(GL.GL_LEQUAL);                                                // type of depth test
                  GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);      // nice perspective calculations
                  //rtri = 30.0f;                  define the rotation angle in the start position of the triangle
                  //rquad = 30.0f;            define the rotation angle in the start position of the quad
            }

            protected override void OnSizeChanged(EventArgs e)
            {
                  base.OnSizeChanged(e);
                  Size s = Size;

                  GL.glMatrixMode(GL.GL_PROJECTION);
                  GL.glLoadIdentity();
                  GL.gluPerspective(45.0f, (double)s.Width /(double) s.Height, 0.1f, 100.0f);      
                  GL.glMatrixMode(GL.GL_MODELVIEW);
                  GL.glLoadIdentity();
            }
      }
      
      public class MainForm : System.Windows.Forms.Form      
      {
            private lesson05.OurView view;

            public MainForm()
            {
                  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                  this.ClientSize = new System.Drawing.Size(640, 480);
                  this.Name = "MainForm";
                  this.Text = "NeHe lesson 05 in C# (by Sabine Felsinger)";
                  this.view = new lesson05.OurView();                  
                  this.view.Parent = this;
                  this.view.Dock = DockStyle.Fill; // Will fill whole form
                  this.Show();
            }

            static void Main()
            {
                  MainForm form = new MainForm();

                  while ((!form.view.finished) && (!form.IsDisposed))            // refreshing the window, so it rotates
                  {
                        form.view.glDraw();
                        form.Refresh();
                        Application.DoEvents();
                  }

                  form.Dispose();
            }
      }
}
0
jsbsudhaAuthor Commented:
Exception error in the statement

base.OnSizeChanged(e);

protected override void OnSizeChanged(EventArgs e)
            {
                  base.OnSizeChanged(e);
                  Size s = Size;

                  GL.glMatrixMode(GL.GL_PROJECTION);
                  GL.glLoadIdentity();
                  GL.gluPerspective(45.0f, (double)s.Width /(double) s.Height, 0.1f, 100.0f);      
                  GL.glMatrixMode(GL.GL_MODELVIEW);
                  GL.glLoadIdentity();
            }
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

ikeworkCommented:
and which exception?  "division by zero"? if yes, check that "s.Height" is not zero in protected override void OnSizeChanged(EventArgs e)
0
jsbsudhaAuthor Commented:
please wait I will check it by opening my file
0
jsbsudhaAuthor Commented:
type initialization exception was hadled in the statement  base.onchanged(e)
0
jsbsudhaAuthor Commented:
I am running the above Csharp program in  VS2005 ....I am getting the error message as

Type initialiazation exception for csgl.OSLib unhanled
0
ikeworkCommented:
can you show the code of base.onchanged(e) and the line the exception was thrown?
0
jsbsudhaAuthor Commented:
the jpg file
pic.jpg
0
ikeworkCommented:
can you click "view detail" and post it here?
0
jsbsudhaAuthor Commented:
view details
pic2.jpg
0
ikeworkCommented:
it says: "the dll csgl.native.dll could not be found"

did you install csgl properly?
0
ikeworkCommented:
did you download csgl from:

http://sourceforge.net/project/downloading.php?group_id=33241&use_mirror=ovh&filename=csgl.1.4.1.dll.zip&60279498

then unzip it and execute libinstall/install.bat

make sure CsGL-namespace is loaded into your project, if not add c:\windows\system32\csgl.dll to project
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jsbsudhaAuthor Commented:
Could you tell me the exact procedure what I have to do
to install csgl in your project
0
ikeworkCommented:
post-overlapping .. check my last comment ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.