fpc/packages/opengl/build/glx_w32d.tem
peter 7039100d0d * new updated version
* gtkglarea unit and demo
  * win32 opengl headers
  * morph3d demo
2000-09-03 21:25:44 +00:00

135 lines
3.0 KiB
Plaintext

{
$Id$
Translation of the Mesa GLX headers for FreePascal
Copyright (C) 1999 Sebastian Guenther
Mesa 3-D graphics library
Version: 3.0
Copyright (C) 1995-1998 Brian Paul
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
{$MODE delphi} // objfpc would not work because of direct proc var assignments
{You have to enable Macros (compiler switch "-Sm") for compiling this unit!
This is necessary for supporting different platforms with different calling
conventions via a single unit.}
unit GLX;
interface
{$MACRO ON}
{$IFDEF Win32}
{$DEFINE glx_dll := external 'unknown.dll'}
uses Windows;
{x$DEFINE HasGLX} // Activate GLX stuff
{$ELSE}
{$MESSAGE Unsupported platform.}
{$ENDIF}
{$IFNDEF HasGLX}
{$MESSAGE GLX not present on this platform.}
{$ENDIF}
// =======================================================
// Unit specific extensions
// =======================================================
// Note: Requires that the GL library has already been initialized
function InitGLX: Boolean;
var
GLXDumpUnresolvedFunctions,
GLXInitialized: Boolean;
// =======================================================
// GLX consts, types and functions
// =======================================================
%GLXDeclsIF
var
%GLXProcsPD
// =======================================================
//
// =======================================================
implementation
type
HInstance = LongWord;
{$IFDEF HasGLX}
var
libGLX : HInstance;
function GetProc(handle: HInstance; name: PChar): Pointer;
begin
Result := GetProcAddress(handle, name);
if (Result = nil) and GLXDumpUnresolvedFunctions then
WriteLn('Unresolved: ', name);
end;
function InitGLX: Boolean;
begin
Result := False;
{ Unix GLX is implemented as special subset of the GL interface }
if libGL = 0 then exit;
glXQueryVersion := GetProcAddress(libGL, 'glXQueryVersion');
if @glXQueryVersion = nil then exit;
%GLXProcsPL
GLXInitialized := True;
Result := True;
end;
{$ENDIF IFDEF HasGLX}
initialization
InitGLX;
finalization
if libGLX <> 0 then FreeLibrary(libGLX);
end.
{
$Log$
Revision 1.1 2000-09-03 21:25:45 peter
* new updated version
* gtkglarea unit and demo
* win32 opengl headers
* morph3d demo
Revision 1.1 2000/07/13 06:34:18 michael
+ Initial import
Revision 1.1 2000/05/31 00:36:08 alex
dummy - incomplete code.
}