ctartamella's picture

Help getting started with GLControl

I am following the docs on using GLControl with Windows forms. I am using C++/CLI though, not C#. Starting with a basic projec t (VS2010) I added OpenTK to the and GLControl to the references, and dropped a GLControl on the form. (It is the only control).

The class itself has a private boolean flag that I set to false in the constructor and switch to true in the Load event of GLControl.

I then hook in the Paint event:

                System::Void glControl1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
                    if (!loaded)
                    GL.ClearColor(0.0, 0.0, 0.0, 1.0);
                    GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit)                   

However, both lines which make calls to GL fire syntax errors saying theres a missing ; before the .

What could I be missing? Any help is appreciated.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

The GL class provides static methods. You need to do:

GL::ClearColor(0.0, 0.0, 0.0, 1.0);