WPF OpenGL framework released

I’m open sourcing my WPF OpenGL framework. It’s still very rough and unpolished.

Some notes:

  • You need a decent graphics card and updated drivers (Nvidia or ATI).
  • It’s based on the OpenTK framework.
  • It still relies on WinForms. Eventually I’ll try to use purely WPF, but the hybrid works for now.
  • I definitely need to clean up the code and document it properly. Until that’s done, just email me if you have questions.
  • The structure from motion demo looks best with anti aliasing overridden at the hardware level. For Nvidia cards, go to the Nvidia control panel –> 3D settings –> Use the advanced 3D settings –> Take me there-> Antialiasing – mode = override, Antialiasing – setting >= 2x. You can hit “Restore” or reselect ‘”Let the 3D application decide” to undo this change.

 

WPFTK boxes    Shader UML

8 thoughts on “WPF OpenGL framework released

  1. Pingback: A Nifty Video (WPF & OpenGL) - Steve Haroz’s Blog

  2. Pingback: Write WebGL in C# with JSC « c# to javascript, actionscript

  3. Chris

    I am trying to implement your framework and I can succesfully raise mouse events when clicking on the GLElement. I cannot raise any Touch events when using a touchscreen, however. could you possibly help me, because I re-wrote the entire application in WPF, so as to use your control with a touch screen.

    Thank you.

    1. Steve Haroz Post author

      Hi Chris,

      Unfortunately, I don’t have a touch device to test on.

      The rendering is performed in GLControl, which is encapsulated in a WindowsFormsHost. Anything inside of a WindowsFormsHost has a very different event system (I have to bubble even basic mouse events up), and it doesn’t really support touch. There may however be ways around that:

      Try encapsulating the GLElement in a Border. Then catch the touch events there. Also try googling specifically for WindowsFormsHost and touch (I couldn’t find much).

      I’ll ask a couple friends who may know better.

      -Steve

  4. Paul

    Hi, Steve!

    I tried to compile your lib+example, but i’ve got an error message in shader programm:
    ” Fragment shader failed to compile with the following errors:
    ERROR: 0:12: error(#132) Syntax error: ‘float3’ parse error
    ERROR: error(#273) 1 compilation errors. No code generated”

    Can You help me with this error?

    1. Steve Haroz Post author

      Hi Paul,

      Because the GLSL compiler lives in the driver, different hw+sw combos differ in how strictly they adhere to the spec. Technically, the types should be float, vec2, vec3, and vec4. The Nvidia hardware that I have lets me get away with float, float2, float3, and float4.

      So in the shader files (vs and fs) replace all vec2 with float2, and do the same for 3 and 4. That problem should be fixed. However, I have a feeling that you have an integrated GPU. If so, the next problem that you’ll face is that the demo instantiates a FrameBufferObject in the beginning, which might make your driver crap out. If that happens, try disabling the framebuffer stuff.

  5. Kraptor

    Is not about having an old GPU. It is just that AMD (like other vendors) are way more restrictive than nVidia. You should replace all occurences from floatX to vecX, and also change the Sampler2D, cause the FS is not really a GLSL conformant shader.

    1. Steve Haroz Post author

      Good point. I made the first version while still transitioning from Cg to GLSL, so I didn’t realize it was a problem until people with AMDs started having problems. I have a newer version that fixes those kinds of problems; I just haven’t had a chance to upload it yet.

Comments are closed.