# Delphi/Free Pascal OpenGL Header for OpenGL 4.4a - Readme -

(obtained and maintained through www.delphigl.com)

## Content

Description
How to use
Support
Credits
Copyright

## Description

This is the readme for the OpenGL-Headers for Delphi/FreePascal that has been developed by DGL's OpenGL2.0-Portteam. Please read carefully through this file before using the header to avoid common problems and faults. The changelog is included in the source file itself.

## Note

OpenGL-Header is for Borland Delphi 4 and above (tested with Delphi 7) and FreePascal.
Containts the translations of glext.h, gl_1_1.h, glu.h and weglext.h.
It also contains some helperfunctions that were inspired by those found in Mike Lischke's OpenGL12.pas.

## How to use

Before you can use any of the gl-functions contained in the header, you'll have to call InitOpenGL to initialize the functionpointers. In your app it should look something like that :

    procedure MyGLInit;
    begin
      InitOpenGL; // Don't forget, or first gl-Call will result in an access violation!
      MyDC := GetDC(...);
      MyRC := CreateRenderingContext(...);
      ActivateRenderingContext(MyDC, MyRC); // Necessary, will also read some extension
      ...
    end;

After doing the above initialisation, you're ready to use all OpenGL-Functions and extensions your card supports. And also don't forget to release your context properly when exiting :

    procedure MyDeInit;
    begin
      DeactivateRenderingContext; // Deactivates the current context
      wglDeleteContext(myRC);
      ReleaseDC(Handle, myDC);
    end;

## Creating a versioned rendering context

As of OpenGL version 4.4, the header offers an additional way of creating a rendercontext, that allows for setting the desired OpenGL version and (if applicable) wether to create a forward compatible context (see OpenGL man pages on what that means) :

    procedure MyGLInit;
    begin
      DC := GetDC(...);
      RC := CreateRenderingContextVersion(DC, [opDoubleBuffered], 4, 2, True, 32, 24, 8, 0, 0, 0); // Creates an OpenGL 4.2 forward-compatible context
      InitOpenGL; // Don't forget, or first gl-Call will result in an access violation!
      ...
    end;

Only use this method of creating a rendering context if you're sure what you're doing. Trying to create a versioned rendering context that's not supported by the target OpenGL implementation may fail!

## Support

If you have problems, want to ask a question or think you may have encountered a bug in the header, please feel free to use the support-threads in our forums :
English support
German support

## Credits

### Converted and maintained by DGL's GL2.0-Team :

Sascha Willems (http://www.delphigl.de)
Steffen Xonna (Lossy eX, http://www.dev-center.de)

### Additional input :

Andrey Gruzdev for the Mac OS X patch for XE2 / FPC Lars Middendorf Martin Waldegger (Mars)
Nico Michaelis (Delphic) for the Linux version of the header (see here)
Benjamin Rosseaux (BeRo) for expanding the header for use with Free Pascal
And thanks to all who helps us to make the header better

## Copyright

The contents of this file 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
http://www.mozilla.org/MPL/MPL-1.1.html

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.

Copyright © 2003-2014 DGL-OpenGL-Portteam - All Rights Reserved