pak's picture

3D spectrogram plot from scratch

Hello all.

I am new into OpenTK, but have 3 years experience in C# programming.
I would like to write an spectrogram in OpenGL, and actually, I don't know how to start. I have read many examples, and I find the framework quite easy to start with, but rough to move on.

What I would like to achieve is more or less, something like this (whithout the bright and light properties and controls):
Function graphics in 3D

but in C#, and reload it X times per second.

I know I can trasnlate some functions directly, but in this example it defines new classes which seem to modify, like COGView : public CView. It also defines new methods adn I don't know if all that effort is worth or I can get it easier with OpenTK.

It would be great if I coud have some advice.
Thank you.


Comments

Comment viewing options

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

CView would be equivalent to OpenTK.GLControl. This takes care of context creation, so you don't need to worry about that part of the code. The rest of the code looks straightforward to translate: COGView::OnDraw becomes GLControl.Paint, mouse events become GLControl.MouseDown/MouseUp/MouseMove and file input can be achieved with System.IO.File.

My suggestion:

  1. create a new WinForms project
  2. add references to OpenTK and OpenTK.GLControl
  3. drag a GLControl onto the form designer and check its available properties and events

Everything should slowly start falling into place. If you haven't used WinForms before, search google for tutorials (WinForms are pretty easy to work with). OpenTK also comes with some example code, check the GLControl examples that ship with it.