![]() ![]() Move the geometry into a fairly central position. Gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT) Get the OpenGL instance that's been passed to us. Private void OpenGLControl_OpenGLDraw( object sender, SharpGL.OpenGLEventArgs args) Using the OpenGLControlĪt the top of the MainWindow.xaml file, add a reference to the SharpGL.WPF assembly: There is also a SharpGL.WinForms assembly that has a similar control for Windows Forms applications. SharpGL.WPF contains a control specifically designed for your WPF applications. SharpGL.dll contains the core OpenGL functionality. Now add the SharpGL and SharpGL.WPF assemblies that you have downloaded as references. Getting StartedĬreate a new WPF application, called WPFOpenGL. ![]() Or if you prefer, the core binaries can be downloaded from the link at the top of the article. Here's the download page, you'll need the core binaries: Get the core binaries from the CodePlex downloads page. SharpGL is a CLR wrapper to the OpenGL library - it supports hardware acceleration and has all core functions and extensions all the way up to the latest version of OpenGL, OpenGL 4.2. This is going to be really straightforward - the first thing to do is grab the latest version of SharpGL. Following that, I'll describe the internals of how this is actually done under the hood - so if you just want to get cracking with OpenGL, you only need to read the first part of the article.īeta Note: This article uses the SharpGL 2.0 Beta 1 release - it's a beta release so may be changed slightly by the time the full release is available. The first thing we'll do is create a project that does some OpenGL rendering. In this article, I am going to show you the steps of how to use OpenGL to render directly into a WPF control - without any kind of fudging of window handles or WinFormsHost objects. Download example application - 128.84 KB. ![]()
0 Comments
Leave a Reply. |