Browse Source

* Patch by Thaddy De Koning to optionally remove the X dependency on Linux (bug ID 24919)

git-svn-id: trunk@26751 -
michael 11 years ago
parent
commit
8c3e98ef9f
1 changed files with 46 additions and 38 deletions
  1. 46 38
      packages/opengles/src/gles20.pas

+ 46 - 38
packages/opengles/src/gles20.pas

@@ -1,4 +1,4 @@
-{** OpenGL ES 2.0 headers 
+{** OpenGL ES 2.0 headers
  **
  **
  ** Ported/Translated for FreePascal by Benjamin 'BeRo' Rosseaux
  ** Ported/Translated for FreePascal by Benjamin 'BeRo' Rosseaux
  ** [email protected] - http://www.rosseaux.com
  ** [email protected] - http://www.rosseaux.com
@@ -35,6 +35,8 @@ unit gles20;
 {$mode objfpc}
 {$mode objfpc}
 {$ifdef linux}
 {$ifdef linux}
   {$define EGL}
   {$define EGL}
+  { undefine X for other Linux windowmanagers }
+  {$define X}
 {$endif}
 {$endif}
 {$ifdef windows}
 {$ifdef windows}
   {$define EGL}
   {$define EGL}
@@ -42,7 +44,7 @@ unit gles20;
 
 
 interface
 interface
 
 
-uses SysUtils,dynlibs{$ifdef linux},x,xlib{$endif}{$ifdef windows},Windows{$endif};
+uses SysUtils,dynlibs{$ifdef X},x,xlib{$endif}{$ifdef windows},Windows{$endif};
 
 
 {$IFDEF FPC}
 {$IFDEF FPC}
 {$PACKRECORDS C}
 {$PACKRECORDS C}
@@ -50,7 +52,7 @@ uses SysUtils,dynlibs{$ifdef linux},x,xlib{$endif}{$ifdef windows},Windows{$endi
 
 
 Type
 Type
   Pchar  = ^char;
   Pchar  = ^char;
-  
+
 {$ifdef EGL}
 {$ifdef EGL}
 type
 type
   PEGLConfig  = ^EGLConfig;
   PEGLConfig  = ^EGLConfig;
@@ -64,13 +66,13 @@ type
 
 
   type
   type
 
 
-{$ifdef linux}
+{$ifdef X}
      EGLNativeDisplayType = PDisplay;
      EGLNativeDisplayType = PDisplay;
 
 
      EGLNativeWindowType = TWindow;
      EGLNativeWindowType = TWindow;
 
 
      EGLNativePixmapType = TPixmap;
      EGLNativePixmapType = TPixmap;
-{$else linux}
+{$else X}
 {$ifdef windows}
 {$ifdef windows}
      EGLNativeDisplayType = HDC;
      EGLNativeDisplayType = HDC;
 
 
@@ -78,13 +80,19 @@ type
 
 
      EGLNativePixmapType = HBITMAP;
      EGLNativePixmapType = HBITMAP;
 {$else windows}
 {$else windows}
-     EGLNativeDisplayType = ptrint;
+     TNativeDisplayType = record
+     { Opaque }
+     end;
+
+     PNativeDisplayType = ^TNativeDisplayType;
+
+     EGLNativeDisplayType = PNativeDisplayType;
 
 
      EGLNativeWindowType = pointer;
      EGLNativeWindowType = pointer;
 
 
      EGLNativePixmapType = pointer;
      EGLNativePixmapType = pointer;
 {$endif windows}
 {$endif windows}
-{$endif linux}
+{$endif X}
 
 
      EGLBoolean = dword;
      EGLBoolean = dword;
 
 
@@ -101,59 +109,59 @@ type
   { EGL Versioning  }
   { EGL Versioning  }
 
 
   const
   const
-     EGL_VERSION_1_0 = 1;     
-     EGL_VERSION_1_1 = 1;     
-     EGL_VERSION_1_2 = 1;     
-     EGL_VERSION_1_3 = 1;     
-     EGL_VERSION_1_4 = 1;     
+     EGL_VERSION_1_0 = 1;
+     EGL_VERSION_1_1 = 1;
+     EGL_VERSION_1_2 = 1;
+     EGL_VERSION_1_3 = 1;
+     EGL_VERSION_1_4 = 1;
   { EGL Enumerants. Bitmasks and other exceptional cases aside, most
   { EGL Enumerants. Bitmasks and other exceptional cases aside, most
    * enums are assigned unique values starting at 0x3000.
    * enums are assigned unique values starting at 0x3000.
     }
     }
   { EGL aliases  }
   { EGL aliases  }
-     EGL_FALSE = 0;     
-     EGL_TRUE = 1;     
+     EGL_FALSE = 0;
+     EGL_TRUE = 1;
   { Out-of-band handle values  }
   { Out-of-band handle values  }
   { was #define dname def_expr }
   { was #define dname def_expr }
-  function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;    
+  function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;
 
 
   { was #define dname def_expr }
   { was #define dname def_expr }
-  function EGL_NO_CONTEXT : EGLContext;    
+  function EGL_NO_CONTEXT : EGLContext;
 
 
   { was #define dname def_expr }
   { was #define dname def_expr }
-  function EGL_NO_DISPLAY : EGLDisplay;    
+  function EGL_NO_DISPLAY : EGLDisplay;
 
 
   { was #define dname def_expr }
   { was #define dname def_expr }
-  function EGL_NO_SURFACE : EGLSurface;    
+  function EGL_NO_SURFACE : EGLSurface;
 
 
   { Out-of-band attribute value  }
   { Out-of-band attribute value  }
   { was #define dname def_expr }
   { was #define dname def_expr }
-  function EGL_DONT_CARE : EGLint;    
+  function EGL_DONT_CARE : EGLint;
 
 
   { Errors / GetError return values  }
   { Errors / GetError return values  }
 
 
   const
   const
-     EGL_SUCCESS = $3000;     
-     EGL_NOT_INITIALIZED = $3001;     
-     EGL_BAD_ACCESS = $3002;     
-     EGL_BAD_ALLOC = $3003;     
-     EGL_BAD_ATTRIBUTE = $3004;     
-     EGL_BAD_CONFIG = $3005;     
-     EGL_BAD_CONTEXT = $3006;     
-     EGL_BAD_CURRENT_SURFACE = $3007;     
-     EGL_BAD_DISPLAY = $3008;     
-     EGL_BAD_MATCH = $3009;     
-     EGL_BAD_NATIVE_PIXMAP = $300A;     
-     EGL_BAD_NATIVE_WINDOW = $300B;     
-     EGL_BAD_PARAMETER = $300C;     
-     EGL_BAD_SURFACE = $300D;     
+     EGL_SUCCESS = $3000;
+     EGL_NOT_INITIALIZED = $3001;
+     EGL_BAD_ACCESS = $3002;
+     EGL_BAD_ALLOC = $3003;
+     EGL_BAD_ATTRIBUTE = $3004;
+     EGL_BAD_CONFIG = $3005;
+     EGL_BAD_CONTEXT = $3006;
+     EGL_BAD_CURRENT_SURFACE = $3007;
+     EGL_BAD_DISPLAY = $3008;
+     EGL_BAD_MATCH = $3009;
+     EGL_BAD_NATIVE_PIXMAP = $300A;
+     EGL_BAD_NATIVE_WINDOW = $300B;
+     EGL_BAD_PARAMETER = $300C;
+     EGL_BAD_SURFACE = $300D;
   { EGL 1.1 - IMG_power_management  }
   { EGL 1.1 - IMG_power_management  }
-     EGL_CONTEXT_LOST = $300E;     
+     EGL_CONTEXT_LOST = $300E;
   { Reserved 0x300F-0x301F for additional errors  }
   { Reserved 0x300F-0x301F for additional errors  }
   { Config attributes  }
   { Config attributes  }
-     EGL_BUFFER_SIZE = $3020;     
-     EGL_ALPHA_SIZE = $3021;     
-     EGL_BLUE_SIZE = $3022;     
-     EGL_GREEN_SIZE = $3023;     
+     EGL_BUFFER_SIZE = $3020;
+     EGL_ALPHA_SIZE = $3021;
+     EGL_BLUE_SIZE = $3022;
+     EGL_GREEN_SIZE = $3023;
      EGL_RED_SIZE = $3024;     
      EGL_RED_SIZE = $3024;     
      EGL_DEPTH_SIZE = $3025;     
      EGL_DEPTH_SIZE = $3025;     
      EGL_STENCIL_SIZE = $3026;     
      EGL_STENCIL_SIZE = $3026;