|
@@ -0,0 +1,306 @@
|
|
|
|
+{
|
|
|
|
+ $Id$
|
|
|
|
+
|
|
|
|
+ Translation of the Mesa GL 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 GL;
|
|
|
|
+
|
|
|
|
+interface
|
|
|
|
+
|
|
|
|
+{$DEFINE GL1_0}
|
|
|
|
+{x$DEFINE GL1_1}
|
|
|
|
+{x$DEFINE GL1_2}
|
|
|
|
+{x$DEFINE MESA} {enable if you want to use some special mesa extensions}
|
|
|
|
+{x$DEFINE EXTENSIONS} {enable if you need one/all of extensions}
|
|
|
|
+{x$DEFINE SGI_EXTENSIONS} {enable if you need one/all of extensions}
|
|
|
|
+
|
|
|
|
+{$MACRO ON}
|
|
|
|
+
|
|
|
|
+{$IFDEF Win32}
|
|
|
|
+ {$DEFINE ogl_dll := }
|
|
|
|
+ uses Windows;
|
|
|
|
+{$ELSE}
|
|
|
|
+ {$MESSAGE Unsupported platform.}
|
|
|
|
+{$ENDIF}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// =======================================================
|
|
|
|
+// Unit specific extensions
|
|
|
|
+// =======================================================
|
|
|
|
+
|
|
|
|
+function InitGLFromLibrary(libname: PChar): Boolean;
|
|
|
|
+
|
|
|
|
+// determines automatically which libraries to use:
|
|
|
|
+function InitGL: Boolean;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+var
|
|
|
|
+ GLDumpUnresolvedFunctions,
|
|
|
|
+ GLInitialized: Boolean;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// =======================================================
|
|
|
|
+// GL consts, types and functions
|
|
|
|
+// =======================================================
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+// GL types
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+
|
|
|
|
+type
|
|
|
|
+ PSingle = ^Single;
|
|
|
|
+ PDouble = ^Double;
|
|
|
|
+
|
|
|
|
+ GLvoid = Pointer;
|
|
|
|
+ GLboolean = Byte;
|
|
|
|
+
|
|
|
|
+ GLbyte = ShortInt; // 1-byte signed
|
|
|
|
+ GLshort = Integer; // 2-byte signed
|
|
|
|
+ GLint = LongInt; // 4-byte signed
|
|
|
|
+
|
|
|
|
+ GLubyte = Byte; // 1-byte unsigned
|
|
|
|
+ GLushort = Word; // 2-byte unsigned
|
|
|
|
+ GLuint = DWord; // 4-byte signed
|
|
|
|
+
|
|
|
|
+ GLsizei = LongInt; // 4-byte signed
|
|
|
|
+
|
|
|
|
+ GLfloat = Single; // single precision float
|
|
|
|
+ GLclampf = Single; // single precision float in [0,1]
|
|
|
|
+ GLdouble = Double; // double precision float
|
|
|
|
+ GLclampd = Double; // double precision float in [0,1]
|
|
|
|
+
|
|
|
|
+ GLenum = DWord;
|
|
|
|
+
|
|
|
|
+ PGLBoolean = ^GLBoolean;
|
|
|
|
+ PGLFloat = ^GLfloat;
|
|
|
|
+ PGLDouble = ^GLDouble;
|
|
|
|
+
|
|
|
|
+type
|
|
|
|
+ GLbitfield = DWord; { was an enum - no corresponding thing in pascal }
|
|
|
|
+const
|
|
|
|
+ GL_CURRENT_BIT = $00000001;
|
|
|
|
+ GL_POINT_BIT = $00000002;
|
|
|
|
+ GL_LINE_BIT = $00000004;
|
|
|
|
+ GL_POLYGON_BIT = $00000008;
|
|
|
|
+ GL_POLYGON_STIPPLE_BIT= $00000010;
|
|
|
|
+ GL_PIXEL_MODE_BIT = $00000020;
|
|
|
|
+ GL_LIGHTING_BIT = $00000040;
|
|
|
|
+ GL_FOG_BIT = $00000080;
|
|
|
|
+ GL_DEPTH_BUFFER_BIT = $00000100;
|
|
|
|
+ GL_ACCUM_BUFFER_BIT = $00000200;
|
|
|
|
+ GL_STENCIL_BUFFER_BIT = $00000400;
|
|
|
|
+ GL_VIEWPORT_BIT = $00000800;
|
|
|
|
+ GL_TRANSFORM_BIT = $00001000;
|
|
|
|
+ GL_ENABLE_BIT = $00002000;
|
|
|
|
+ GL_COLOR_BUFFER_BIT = $00004000;
|
|
|
|
+ GL_HINT_BIT = $00008000;
|
|
|
|
+ GL_EVAL_BIT = $00010000;
|
|
|
|
+ GL_LIST_BIT = $00020000;
|
|
|
|
+ GL_TEXTURE_BIT = $00040000;
|
|
|
|
+ GL_SCISSOR_BIT = $00080000;
|
|
|
|
+ GL_ALL_ATTRIB_BITS = $000fffff;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+// GL constants
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+
|
|
|
|
+{$IFDEF GL1_0}
|
|
|
|
+%GLDeclsIF10
|
|
|
|
+{$ENDIF GL1_0}
|
|
|
|
+
|
|
|
|
+{$IFDEF GL1_1}
|
|
|
|
+%GLDeclsIF11
|
|
|
|
+{$ENDIF GL1_1}
|
|
|
|
+
|
|
|
|
+{$IFDEF GL1_2}
|
|
|
|
+%GLDeclsIF12
|
|
|
|
+{$ENDIF GL1_2}
|
|
|
|
+
|
|
|
|
+const
|
|
|
|
+ // Utility
|
|
|
|
+ GL_VENDOR = $1F00;
|
|
|
|
+ GL_RENDERER = $1F01;
|
|
|
|
+ GL_VERSION = $1F02;
|
|
|
|
+ GL_EXTENSIONS = $1F03;
|
|
|
|
+
|
|
|
|
+ // Errors
|
|
|
|
+ GL_INVALID_VALUE = $0501;
|
|
|
|
+ GL_INVALID_ENUM = $0500;
|
|
|
|
+ GL_INVALID_OPERATION = $0502;
|
|
|
|
+ GL_STACK_OVERFLOW = $0503;
|
|
|
|
+ GL_STACK_UNDERFLOW = $0504;
|
|
|
|
+ GL_OUT_OF_MEMORY = $0505;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+// GL extensions constants
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+
|
|
|
|
+{$IFDEF EXTENSIONS}
|
|
|
|
+%GLDeclsIF10Ext
|
|
|
|
+{$ENDIF EXTENSIONS}
|
|
|
|
+
|
|
|
|
+{$IFDEF SGI_EXTENSIONS}
|
|
|
|
+%GLDeclsIF10SGI
|
|
|
|
+{$ENDIF SGI_EXTENSIONS}
|
|
|
|
+
|
|
|
|
+{$IFDEF MESA}
|
|
|
|
+%GLDeclsIF10Mesa
|
|
|
|
+{$ENDIF MESA}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+// GL procedures and functions
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+
|
|
|
|
+{$IFDEF GL1_0}
|
|
|
|
+var
|
|
|
|
+%GLProcsPD10
|
|
|
|
+{$ENDIF GL1_0}
|
|
|
|
+
|
|
|
|
+{$IFDEF GL1_1}
|
|
|
|
+var
|
|
|
|
+%GLProcsPD11
|
|
|
|
+{$ENDIF GL1_1}
|
|
|
|
+
|
|
|
|
+{$IFDEF GL1_2}
|
|
|
|
+var
|
|
|
|
+%GLProcsPD12
|
|
|
|
+{$ENDIF GL1_2}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+// GL Extensions
|
|
|
|
+// -------------------------------------------------------
|
|
|
|
+
|
|
|
|
+{$IFDEF EXTENSIONS}
|
|
|
|
+var
|
|
|
|
+%GLProcsPD10Ext
|
|
|
|
+{$ENDIF EXTENSIONS}
|
|
|
|
+
|
|
|
|
+// library dependent extensions
|
|
|
|
+
|
|
|
|
+{$IFDEF SGI_EXTENSIONS}
|
|
|
|
+var
|
|
|
|
+%GLProcsPD10SGI
|
|
|
|
+{$ENDIF SGI_EXTENSIONS}
|
|
|
|
+
|
|
|
|
+{$ifdef MESA}
|
|
|
|
+var
|
|
|
|
+%GLProcsPD10Mesa
|
|
|
|
+{$endif MESA}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// =======================================================
|
|
|
|
+// =======================================================
|
|
|
|
+
|
|
|
|
+implementation
|
|
|
|
+
|
|
|
|
+type
|
|
|
|
+ HInstance = LongWord;
|
|
|
|
+
|
|
|
|
+var
|
|
|
|
+ libGL : HInstance;
|
|
|
|
+
|
|
|
|
+function GetProc(handle: HInstance; name: PChar): Pointer;
|
|
|
|
+begin
|
|
|
|
+ Result := GetProcAddress(handle, name);
|
|
|
|
+ if (Result = nil) and GLDumpUnresolvedFunctions then
|
|
|
|
+ WriteLn('Unresolved: ', name);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function InitGLFromLibrary(libname: PChar): Boolean;
|
|
|
|
+begin
|
|
|
|
+ Result := False;
|
|
|
|
+ libGL := LoadLibrary(libname);
|
|
|
|
+ if libGL = 0 then exit;
|
|
|
|
+
|
|
|
|
+{$ifdef GL1_0}
|
|
|
|
+%GLProcsPL10
|
|
|
|
+{$endif GL1_0}
|
|
|
|
+
|
|
|
|
+{$ifdef GL1_1}
|
|
|
|
+%GLProcsPL11
|
|
|
|
+{$endif GL1_1}
|
|
|
|
+
|
|
|
|
+{$ifdef GL1_2}
|
|
|
|
+%GLProcsPL12
|
|
|
|
+{$endif GL1_2}
|
|
|
|
+
|
|
|
|
+{$ifdef EXTENSIONS}
|
|
|
|
+%GLProcsPL10Ext
|
|
|
|
+{$endif EXTENSIONS}
|
|
|
|
+
|
|
|
|
+{$ifdef SGI_EXTENSIONS}
|
|
|
|
+%GLProcsPL10SGI
|
|
|
|
+{$endif SGI_EXTENSIONS}
|
|
|
|
+
|
|
|
|
+{$ifdef MESA}
|
|
|
|
+%GLProcsPL10Mesa
|
|
|
|
+{$endif MESA}
|
|
|
|
+
|
|
|
|
+ GLInitialized := True;
|
|
|
|
+ Result := True;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+function InitGL: Boolean;
|
|
|
|
+begin
|
|
|
|
+ Result := InitGLFromLibrary('opengl32.dll');
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+initialization
|
|
|
|
+ InitGL;
|
|
|
|
+finalization
|
|
|
|
+ if libGL <> 0 then FreeLibrary(libGL);
|
|
|
|
+end.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+{
|
|
|
|
+ $Log$
|
|
|
|
+ Revision 1.1.2.1 2000-09-03 22:15:06 peter
|
|
|
|
+ * typo fix
|
|
|
|
+
|
|
|
|
+ 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:17 michael
|
|
|
|
+ + Initial import
|
|
|
|
+
|
|
|
|
+ Revision 1.2 2000/05/31 00:34:28 alex
|
|
|
|
+ made templates work
|
|
|
|
+
|
|
|
|
+}
|