Aus DGL Wiki
Version vom 19. März 2009, 23:33 Uhr von Flash (Diskussion | Beiträge) (Link auf Deutsche Version)

Wechseln zu: Navigation, Suche
Info DGL.png Delphi is already shipping with an OpenGL header, but that header is outdated and also buggy. Therefore we urge everyone to NOT use that header, especially as it lacks most of OpenGL's current functionality.

The DelphiGL header

So to compensate for the flaws of the outdated and buggy default header that is shipped with Delphi, the (german) Delphi OpenGL Community is providing it's own header that's permanently updated to provide steady support for new OpenGL features and functionality. This makes updating to a new header version easily (usually backwards compatibility is preserved), and it's even possible to use the header with other pascal compilers like Freepascal.

It includes all OpenGL functions (currently up-to and including OpenGL 3.0) as well as all GLU (OpenGL Utility Libary) functions and supports all ARB, EXT, NV and ATI extensions. It also includes additional, though lesser common extensions from other vendors like Apple, HP and SGI.

A special feature of this header are boolean variables for each included extensions that are flagged upon initialisation (those boolean vars carry the same as their corresponding extensions), so you can quickly check wether an extension is support or not (instead of checking the strings returned by glGetString/en).

Licence/Terms of use

The dglOpenGL.pas is distributed unter the terms and conditions of the Mozilla Public License Version 1.1. You can grab a copy of that licence here.

The contents of the dglOpenGL.pas are used with permission, subject to
the Mozilla Public License Version 1.1 (the "License"); you may
not use this file except in compliance with the License. You may
obtain a copy of the License at

Software distributed under the License is distributed on an
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.

.NET support

Due to lack of interest, .NET support has been removed as of header version 2.1!

Info DGL.png The .Net header won't be developed any further, but reported errors may be fixed. So new OpenGL functionality can only be found in the normal header.

Initializing function pointers (crucial, see readme)

Along with the removal of .NET support, support for loading methods dynamically has also been removed and is no longer possible with the standard header. So it's crucial to call either AtivateRenderingContext or ReadExtensions alongside with ReadImplementationProperties in your application before accessing any of the OpenGL functions. Otherwise you'll likely be prompted with an access violation at address 0x00000000.

So if you get such an access violation please check if you called the above functions!


Version 1.0   - Initial Release

Version 1.1   - Added PPointer in Tpyessection for compatiblity with Delphi
                versions lower than 7                                    (SW)
              - Added a function named RaiseLastOSError including a comment
                on how to make it run under Delphi versions lower than 7 (SW)
              - Added some data types according to the GL-Syntax         (SW)

Version 1.2   - Fixed some problems with getting the addresses of some
                Extensions (e.g. glTexImage3D) where the EXT/ARB did work
                but not the core-functions                               (SW)

Version 1.3   - A second call to ReadimplementationProperties won't
                revert to the default libs anymore                       (MW)
              - Libraries now will be released if necessary              (MW)

Version 1.3a  - Small fixes for glSlang-functions                        (SW)

Version 1.3b  - Fixed a small bug with GL_ARB_shader_objects, that lead
                lead to that extension not loaded correctly              (SW)

Version 1.3c  - More GL 1.5 compliance by FOG_COORD_xx and
                ARB-less VBO and occlusion query routines                (MW)

Version 1.3d  - Fixed linebreaks (should now be corrected under D5)      (SW)

Version 1.4   - Changed header to correspond to the OpenGL-Shading
              - Language specification 1.10 :
                 - Added new GL_SAMPLER_*-Constants
                 - Added Constant GL_SHADING_LANGUAGE_VERSION_ARB
                 - Added Constant GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB
              - Added Constant GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB    (SW)

Version 1.4a  - Fixed a missing stdcall for glBindAttribLocationARB      (SW)

Version 1.4b  - Fixed declaration for glUniform*(f/i)vARB (added count)  (MW)
              - glCompileShaderARB changed from function to procedure    (MW)

Version 1.5   - Added support for FreePascal                             (BR)
              - Added type TGLVectorf3/TGLVector3f                       (SW)

Version 1.6   - Added Extension GL_EXT_framebuffer_object                (SX)

Version 1.7   - Added Extension GL_ARB_fragment_program_shadow           (SX)
              - Added Extension GL_ARB_draw_buffers                      (SX)
              - Added Extension GL_ARB_texture_rectangle                 (SX)
              - Added Extension GL_ARB_color_buffer_float                (SX)
              - Added Extension GL_ARB_half_float_pixel                  (SX)
              - Added Extension GL_ARB_texture_float                     (SX)
              - Added Extension GL_ARB_pixel_buffer_object               (SX)
              - Added Extension GL_EXT_depth_bounds_test                 (SX)
              - Added Extension GL_EXT_texture_mirror_clamp              (SX)
              - Added Extension GL_EXT_blend_equation_separate           (SX)
              - Added Extension GL_EXT_pixel_buffer_object               (SX)
              - Added Extension GL_EXT_texture_compression_dxt1          (SX)
              - Added Extension GL_NV_fragment_program_option            (SX)
              - Added Extension GL_NV_fragment_program2                  (SX)
              - Added Extension GL_NV_vertex_program2_option             (SX)
              - Added Extension GL_NV_vertex_program3                    (SX)

Version 1.8   - Added explicit delegate type definitions                 (LM)
              - Added .Net 1.1 Support                                   (LM)
              - Added .Net overloaded functions                          (LM)
              - Added delayed extension loading and stubs                (LM)
              - Added automatic InitOpenGL call in CreateRenderingContext(LM)
              - Added extra Read_* function                              (LM)

Version 2.0   - fixed some Problem with version string and damn drivers.
                String 1.15 identified as OpenGL 1.5 not as OpenGL 1.1   (SX)
              - Removed unexisting extension GL_ARB_texture_mirror_repeat(SX)
              - Added Extension WGL_ARB_pixel_format_float               (SX)
              - Added Extension GL_EXT_stencil_clear_tag                 (SX)
              - Added Extension GL_EXT_texture_rectangle                 (SX)
              - Added Extension GL_EXT_texture_edge_clamp                (SX)
              - Some 1.5 Core Consts added (now completed)               (SX)
              - gluProject need pointer for not .net                     (SX)
              - gluUnProject need pointer for not .net                   (SX)
              - wglUseFontOutlines* need pointer for not .net            (SX)
              - wglSwapMultipleBuffers need pointer for not .net         (SX)
              - Bug with wglGetExtensionsStringEXT removed
                different type for .net                                  (SX)
              - Added OpenGL 2.0 Core                                    (SX)

Version 2.0.1 - fixed some problems with glGetActiveAttrib in 2.0 Core   (SX)
              - fixes some problems with gluProject                      (SX)
              - fixes some problems with gluUnProject                    (SX)
              - fixes some problems with gluTessVertex                   (SX)
              - fixes some problems with gluLoadSamplingMatrices         (SX)

Version 2.1   - Removed .NET Support                                     (SX)
              - Better support for Linux                                 (SX)
              - Better Codeformation                                     (SX)
              - Added some more Vector/Matrix types                      (SX)
              - Added OpenGL 2.1 Core                                    (SX)
              - Added Extension GL_EXT_packed_depth_stencil              (SX)
              - Added Extension GL_EXT_texture_sRGB                      (SX)
              - Added Extension GL_EXT_framebuffer_blit                  (SX)
              - Added Extension GL_EXT_framebuffer_multisample           (SX)
              - Added Extension GL_EXT_timer_query                       (SX)
              - Added Extension GL_EXT_gpu_program_parameters            (SX)
              - Added Extension GL_EXT_bindable_uniform                  (SX)
              - Added Extension GL_EXT_draw_buffers2                     (SX)
              - Added Extension GL_EXT_draw_instanced                    (SX)
              - Added Extension GL_EXT_framebuffer_sRGB                  (SX)
              - Added Extension GL_EXT_geometry_shader4                  (SX)
              - Added Extension GL_EXT_gpu_shader4                       (SX)
              - Added Extension GL_EXT_packed_float                      (SX)
              - Added Extension GL_EXT_texture_array                     (SX)
              - Added Extension GL_EXT_texture_buffer_object             (SX)
              - Added Extension GL_EXT_texture_compression_latc          (SX)
              - Added Extension GL_EXT_texture_compression_rgtc          (SX)
              - Added Extension GL_EXT_texture_integer                   (SX)
              - Added Extension GL_EXT_texture_shared_exponent           (SX)
              - Added Extension GL_NV_depth_buffer_float                 (SX)
              - Added Extension GL_NV_fragment_program4                  (SX)
              - Added Extension GL_NV_framebuffer_multisample_coverage   (SX)
              - Added Extension GL_NV_geometry_program4                  (SX)
              - Added Extension GL_NV_gpu_program4                       (SX)
              - Added Extension GL_NV_parameter_buffer_object            (SX)
              - Added Extension GL_NV_transform_feedback                 (SX)
              - Added Extension GL_NV_vertex_program4                    (SX)

Version 3.0   - fixed some const of GL_EXT_texture_shared_exponent       (SX)
              - possible better support for mac                          (SX)
              - Added OpenGL 3.0 Core                                    (SX)
              - Added Extension GL_ARB_depth_buffer_float                (SX)
              - Added Extension GL_ARB_draw_instanced                    (SX)
              - Added Extension GL_ARB_framebuffer_object                (SX)
              - Added Extension GL_ARB_framebuffer_sRGB                  (SX)
              - Added Extension GL_ARB_geometry_shader4                  (SX)
              - Added Extension GL_ARB_half_float_vertex                 (SX)
              - Added Extension GL_ARB_instanced_arrays                  (SX)
              - Added Extension GL_ARB_map_buffer_range                  (SX)
              - Added Extension GL_ARB_texture_buffer_object             (SX)
              - Added Extension GL_ARB_texture_compression_rgtc          (SX)
              - Added Extension GL_ARB_texture_rg                        (SX)
              - Added Extension GL_ARB_vertex_array_object               (SX)
              - Added Extension GL_NV_conditional_render                 (SX)
              - Added Extension GL_NV_present_video                      (SX)
              - Added Extension GL_EXT_transform_feedback                (SX)
              - Added Extension GL_EXT_direct_state_access               (SX)
              - Added Extension GL_EXT_vertex_array_bgra                 (SX)
              - Added Extension GL_EXT_texture_swizzle                   (SX)
              - Added Extension GL_NV_explicit_multisample               (SX)
              - Added Extension GL_NV_transform_feedback2                (SX)
              - Added Extension WGL_ARB_create_context                   (SX)
              - Added Extension WGL_NV_present_video                     (SX)
              - Added Extension WGL_NV_video_out                         (SX)
              - Added Extension WGL_NV_swap_group                        (SX)
              - Added define DGL_TINY_HEADER to suppress automatic
                function loading                                         (SX)
              - glProcedure renamed to dglGetProcAddress and now it's
                visible from outside the unit to custom load functions   (SX)
              - dglCheckExtension added to check if an extension exists  (SX)
              - Read_GL_ARB_buffer_object renamed to
                Read_GL_ARB_vertex_buffer_object                         (SX)
Version 3.0.1 - fixed an problem with fpc                                (SX)

Version 3.0.2 - fixed an problem with WGL_ARB_create_context             (SX)


Current dglOpenGL.pas (Supports OpenGL 3.0, works with Delphi 4 and up and Freepascal))

Last dglOpenGL.pas wit .NET support (Supports OpenGL 2.1)

For Delphi 3 users : Mars has posted a version of the dglOpenGL.pas that will work with Delphi 3, you can get it here :
dglOpenGL.pas for Delphi 3
(You need to be registered on the forums to download it)

There is also an inofficial version of this headers for C++.