OpenGL Viewport control for Borland Delphi 2 ============================================ This is a viewport control for Borland Delphi 2. It may or may not work with other versions of Delphi (but it should, perhaps with some minor modifications). It also includes OpenGL 4.6 bindings. The license is zlib: Copyright (c) 2018 Kostas Michalopoulos This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Installation: ------------- Copy the OpenGL.pas, DGLVP.pas and DGLVP.dcr files in some place from where Delphi will pick it up when building applications that use it (e.g. C:\Code\DGLVP). Then from Component menu select Install and then use the Add... button to locate the DGLVP.pas file. Press OK to rebuild the component library. The new component should be available in the Additional tab as TOpenGLViewport. Usage: ------ The component is a simple TWinControl descendant so you use it like any other control - place it on a form, assign events, etc. For rendering you need to assign the OnRender event (call Invalidate to force a re-render). The control exposes the MakeCurrent and SwapBuffers methods to activate the OpenGL context and swap the back and front buffers, but these are only necessary if you need to use the control outside of the OnRender. Your OnRender handler does not need to call these functions since they are called by the control before calling OnRender. In addition the control will also set up the OpenGL viewport by calling glViewport so you can issue OpenGL commands immediately without any need of setup. The control will always request a double buffered RGBA (24 color bits, 8 alpha bits) frame buffer with an 24bit depth buffer and 8bit stencil buffer. In the future a property will be provided to control this if necessary. Also since the control uses the original Windows API for creating the context, it will always create a compatibility context. If you want the context to share resources (display lists, textures, etc) with other contexts you should call ShareResourcesWith before the context has been created (the context is created the first time the control tries to paint itself). If you use the OpenGL bindings unit outside of OnRender (e.g. by making your own control or manually creating a window with CreateWindow, etc), you must call LoadGLProcs right after creating the OpenGL context.