A Nifty Video (WPF & OpenGL)

*Update: I released the framework.

I needed the ability to manipulate lots of geometry in WPF. Unfortunately, that’s just not feasible with the current framework, so I made this little demo to test out an OpenGL framework that I’ve been working on. It uses vertex shaders, pixel shaders, and framebuffers with some hacked together binding.

For those of you at MIX 09, this was the app that I was playing with.

, , , by

7 thoughts on “A Nifty Video (WPF & OpenGL)

  1. David

    Hi, I am a Ph.D. student in the Computer Science too, and I have been looking for examples of WPF and OpenGL and I find your blog! 🙂 First of all, sorry for my english…it is not as good as I’d like and I hope you understand me.

    I’d like to know how do you design the interfaces and how you connect opengl and wpf. Are you using some external application like Microsoft Expression Blend? If you had a simple skeleton of an application wpf and opengl I would be very very grateful. Thanks a lot!


  2. Steve Haroz Post author

    Hi David,

    Tu ingles es mejor que mi espanol 🙂

    The overall UI was done in Blend. I also created an ‘OpenGLElement’ in C# that works like a Panel. I had to do some hacking to get it working. The framework is based off of OpenTK (opentk.com), which I encapsulated in several custom classes.

    Unfortunately, I was figuring out how to do it as I coded. So the code fairly messy and difficult to separate. I’m going to be working on cleaning it up when I can find time over the next couple of months. When it’s usable, I’ll shoot you an email.

  3. David

    Hi Sharoz.

    thanks a lot for answering me too quickly 🙂
    Ok, I’ll try to make a simple example which allow me test opengl in wpf.

    I need something very similar as you show in the video, with the openGl panel in the right and some special, tabs and buttons in the left, so I’ll be waiting for your mail to catch ideas…thanks again!!

  4. Nelson Silva


    This example is awsome!
    I desesperatly need to know how to do this!?
    Any chances of having a ready to compile example on how to have this kind of integration between OPENGL and WPF? Pleassseeee…?

    Nice Work!


  5. Guang Yang

    Hi Steve,

    I would love to know how did you hook up WPF and OpenTK. I know in Windows Forms, you can get a GlControl and put it in your WinForms designer, but that doesn’t work for WPF application. Looks you’ve done a wonderful job fusing them together. I bet there are another thousand of people like me wondering how did you do it.

    Can you please share with us your secret? Code sample would be lovely, if not, some simple description will also enlighten us.

    Thanks in advance!

  6. Guang Yang

    Hi Steve,

    After posting the above message I found you’ve done a generous offering to share out your code!

    Happily downloading! Thanks!

Comments are closed.