// Please uncomment the defines below to configure the glBitmap to your preferences.
// If you have configured the unit you can uncomment the warning above.
-{$MESSAGE error 'Hey. I''m the glBitmap.pas and i need to be configured. My master tell me your preferences! ;)'}
+{.$MESSAGE error 'Hey. I''m the glBitmap.pas and i need to be configured. My master tell me your preferences! ;)'}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Preferences ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// enable OpenGL ES support
+{.$DEFINE OPENGL_ES_1_1}
+{.$DEFINE OPENGL_ES_2_0}
+{.$DEFINE OPENGL_ES_3_0}
+{.$DEFINE OPENGL_ES_EXT}
+
// activate to enable build-in OpenGL support with statically linked methods
// use dglOpenGL.pas if not enabled
{.$DEFINE GLB_NATIVE_OGL_STATIC}
{$DEFINE GLB_LINUX}
{$IFEND}
+// OpenGL ES
+{$IF DEFINED(OPENGL_ES_EXT)} {$DEFINE OPENGL_ES_1_1} {$IFEND}
+{$IF DEFINED(OPENGL_ES_3_0)} {$DEFINE OPENGL_ES_2_0} {$IFEND}
+{$IF DEFINED(OPENGL_ES_2_0)} {$DEFINE OPENGL_ES_1_1} {$IFEND}
+{$IF DEFINED(OPENGL_ES_1_1)} {$DEFINE OPENGL_ES} {$IFEND}
+
// native OpenGL Support
{$IF DEFINED(GLB_NATIVE_OGL_STATIC) OR DEFINED(GLB_NATIVE_OGL_DYNAMIC)}
- {$DEFINE GLB_NATIVE_OGL}
+ {$IFDEF OPENGL_ES}
+ {$ERROR 'native OpenGL is not supported yet for OpenGL ES, please use dglOpenGLES.pas instead'}
+ {$ELSE}
+ {$DEFINE GLB_NATIVE_OGL}
+ {$ENDIF}
{$IFEND}
// checking define combinations
interface
uses
- {$IFNDEF GLB_NATIVE_OGL} dglOpenGL, {$ENDIF}
+ {$IFNDEF GLB_NATIVE_OGL}
+ {$IFDEF OPENGL_ES} dglOpenGLES,
+ {$ELSE} dglOpenGL, {$ENDIF}
+ {$ENDIF}
{$IF DEFINED(GLB_WIN) AND
(DEFINED(GLB_NATIVE_OGL) OR
DEFINED(GLB_DELPHI))} windows, {$IFEND}
fFreeDataOnDestroy: Boolean;
fFreeDataAfterGenTexture: Boolean;
fData: PByte;
+{$IFNDEF OPENGL_ES}
fIsResident: GLboolean;
+{$ENDIF}
fBorderColor: array[0..3] of Single;
fDimension: TglBitmapPixelPosition;
fWrapT: GLenum;
fWrapR: GLenum;
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
//Swizzle
fSwizzle: array[0..3] of GLenum;
+{$IFEND}
// CustomData
fFilename: String;
procedure SetAnisotropic(const aValue: Integer);
procedure CreateID;
- procedure SetupParameters(out aBuildWithGlu: Boolean);
+ procedure SetupParameters({$IFNDEF OPENGL_ES}out aBuildWithGlu: Boolean{$ENDIF});
procedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat;
const aWidth: Integer = -1; const aHeight: Integer = -1); virtual; //be careful, aData could be freed by this method
procedure GenTexture(const aTestTextureSize: Boolean = true); virtual; abstract;
property Dimension: TglBitmapPixelPosition read fDimension;
property Data: PByte read fData;
+{$IFNDEF OPENGL_ES}
property IsResident: GLboolean read fIsResident;
+{$ENDIF}
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
function Clone: TglBitmap;
function ConvertTo(const aFormat: TglBitmapFormat): Boolean; virtual;
procedure Invert(const aUseRGB: Boolean = true; const aUseAlpha: Boolean = false);
+{$IFNDEF OPENGL_ES}
procedure SetBorderColor(const aRed, aGreen, aBlue, aAlpha: Single);
+{$ENDIF}
procedure FreeData;
//ColorFill
const S: GLenum = GL_CLAMP_TO_EDGE;
const T: GLenum = GL_CLAMP_TO_EDGE;
const R: GLenum = GL_CLAMP_TO_EDGE);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
procedure SetSwizzle(const r, g, b, a: GLenum);
+{$IFEND}
procedure Bind(const aEnableTextureUnit: Boolean = true); virtual;
procedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+{$IFNDEF OPENGL_ES}
TglBitmap1D = class(TglBitmap)
protected
procedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat;
function FlipHorz: Boolean; override;
procedure GenTexture(const aTestTextureSize: Boolean = true); override;
end;
+{$ENDIF}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TglBitmap2D = class(TglBitmap)
function GetScanline(const aIndex: Integer): Pointer;
procedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat;
const aWidth: Integer = - 1; const aHeight: Integer = - 1); override;
- procedure UploadData(const aTarget: GLenum; const aBuildWithGlu: Boolean);
+ procedure UploadData(const aTarget: GLenum{$IFNDEF OPENGL_ES}; const aBuildWithGlu: Boolean{$ENDIF});
public
property Width;
property Height;
procedure AfterConstruction; override;
procedure GrabScreen(const aTop, aLeft, aRight, aBottom: Integer; const aFormat: TglBitmapFormat);
+{$IFNDEF OPENGL_ES}
procedure GetDataFromTexture;
+{$ENDIF}
procedure GenTexture(const aTestTextureSize: Boolean = true); override;
function FlipHorz: Boolean; override;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
TglBitmapCubeMap = class(TglBitmap2D)
protected
+ {$IFNDEF OPENGL_ES}
fGenMode: Integer;
+ {$ENDIF}
procedure GenTexture(const aTestTextureSize: Boolean = true); reintroduce;
public
procedure AfterConstruction; override;
procedure GenerateCubeMap(const aCubeTarget: Cardinal; const aTestTextureSize: Boolean = true);
- procedure Bind(const aEnableTexCoordsGen: Boolean = true; const aEnableTextureUnit: Boolean = true); reintroduce; virtual;
- procedure Unbind(const aDisableTexCoordsGen: Boolean = true; const aDisableTextureUnit: Boolean = true); reintroduce; virtual;
+ procedure Bind({$IFNDEF OPENGL_ES}const aEnableTexCoordsGen: Boolean = true;{$ENDIF} const aEnableTextureUnit: Boolean = true); reintroduce; virtual;
+ procedure Unbind({$IFNDEF OPENGL_ES}const aDisableTexCoordsGen: Boolean = true;{$ENDIF} const aDisableTextureUnit: Boolean = true); reintroduce; virtual;
end;
+{$IFEND}
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TglBitmapNormalMap = class(TglBitmapCubeMap)
public
procedure AfterConstruction; override;
procedure GenerateNormalMap(const aSize: Integer = 32; const aTestTextureSize: Boolean = true);
end;
+{$IFEND}
const
NULL_SIZE: TglBitmapPixelPosition = (Fields: []; X: 0; Y: 0);
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
procedure glBitmapSetDefaultSwizzle(const r: GLenum = GL_RED; g: GLenum = GL_GREEN; b: GLenum = GL_BLUE; a: GLenum = GL_ALPHA);
begin
glDefaultSwizzle[0] := r;
glDefaultSwizzle[2] := b;
glDefaultSwizzle[3] := a;
end;
+{$IFEND}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function glBitmapGetDefaultDeleteTextureOnFree: Boolean;
R := glBitmapDefaultWrapR;
end;
+{$IFNDEF OPENGL_ES}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure glBitmapGetDefaultSwizzle(var r, g, b, a: GLenum);
begin
b := glDefaultSwizzle[2];
a := glDefaultSwizzle[3];
end;
+{$ENDIF}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TFormatDescriptor///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
fBitsPerPixel := 8;
fFormat := tfAlpha4ub1;
fWithAlpha := tfAlpha4ub1;
- fOpenGLFormat := tfAlpha4ub1;
fPrecision := glBitmapRec4ub(0, 0, 0, 8);
fShift := glBitmapRec4ub(0, 0, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfAlpha4ub1;
fglFormat := GL_ALPHA;
fglInternalFormat := GL_ALPHA4;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := tfAlpha8ub1;
+{$ENDIF}
end;
procedure TfdAlpha8ub1.SetValues;
fBitsPerPixel := 8;
fFormat := tfAlpha8ub1;
fWithAlpha := tfAlpha8ub1;
- fOpenGLFormat := tfAlpha8ub1;
fPrecision := glBitmapRec4ub(0, 0, 0, 8);
fShift := glBitmapRec4ub(0, 0, 0, 0);
+ fOpenGLFormat := tfAlpha8ub1;
fglFormat := GL_ALPHA;
- fglInternalFormat := GL_ALPHA8;
+ fglInternalFormat := {$IFNDEF OPENGL_ES}GL_ALPHA8{$ELSE}GL_ALPHA{$ENDIF};
fglDataFormat := GL_UNSIGNED_BYTE;
end;
fBitsPerPixel := 16;
fFormat := tfAlpha16us1;
fWithAlpha := tfAlpha16us1;
- fOpenGLFormat := tfAlpha16us1;
fPrecision := glBitmapRec4ub(0, 0, 0, 16);
fShift := glBitmapRec4ub(0, 0, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfAlpha16us1;
fglFormat := GL_ALPHA;
fglInternalFormat := GL_ALPHA16;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfAlpha8ub1;
+{$ENDIF}
end;
procedure TfdLuminance4ub1.SetValues;
fFormat := tfLuminance4ub1;
fWithAlpha := tfLuminance4Alpha4ub2;
fWithoutAlpha := tfLuminance4ub1;
- fOpenGLFormat := tfLuminance4ub1;
fPrecision := glBitmapRec4ub(8, 8, 8, 0);
fShift := glBitmapRec4ub(0, 0, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfLuminance4ub1;
fglFormat := GL_LUMINANCE;
fglInternalFormat := GL_LUMINANCE4;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := tfLuminance8ub1;
+{$ENDIF}
end;
procedure TfdLuminance8ub1.SetValues;
fPrecision := glBitmapRec4ub(8, 8, 8, 0);
fShift := glBitmapRec4ub(0, 0, 0, 0);
fglFormat := GL_LUMINANCE;
- fglInternalFormat := GL_LUMINANCE8;
+ fglInternalFormat := {$IFNDEF OPENGL_ES}GL_LUMINANCE8{$ELSE}GL_LUMINANCE{$ENDIF};
fglDataFormat := GL_UNSIGNED_BYTE;
end;
fFormat := tfLuminance16us1;
fWithAlpha := tfLuminance16Alpha16us2;
fWithoutAlpha := tfLuminance16us1;
- fOpenGLFormat := tfLuminance16us1;
fPrecision := glBitmapRec4ub(16, 16, 16, 0);
fShift := glBitmapRec4ub( 0, 0, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfLuminance16us1;
fglFormat := GL_LUMINANCE;
fglInternalFormat := GL_LUMINANCE16;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfLuminance8ub1;
+{$ENDIF}
end;
procedure TfdLuminance4Alpha4ub2.SetValues;
fFormat := tfLuminance4Alpha4ub2;
fWithAlpha := tfLuminance4Alpha4ub2;
fWithoutAlpha := tfLuminance4ub1;
- fOpenGLFormat := tfLuminance4Alpha4ub2;
fPrecision := glBitmapRec4ub(8, 8, 8, 8);
fShift := glBitmapRec4ub(0, 0, 0, 8);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfLuminance4Alpha4ub2;
fglFormat := GL_LUMINANCE_ALPHA;
fglInternalFormat := GL_LUMINANCE4_ALPHA4;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := tfLuminance8Alpha8ub2;
+{$ENDIF}
end;
procedure TfdLuminance6Alpha2ub2.SetValues;
fFormat := tfLuminance6Alpha2ub2;
fWithAlpha := tfLuminance6Alpha2ub2;
fWithoutAlpha := tfLuminance8ub1;
- fOpenGLFormat := tfLuminance6Alpha2ub2;
fPrecision := glBitmapRec4ub(8, 8, 8, 8);
fShift := glBitmapRec4ub(0, 0, 0, 8);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfLuminance6Alpha2ub2;
fglFormat := GL_LUMINANCE_ALPHA;
fglInternalFormat := GL_LUMINANCE6_ALPHA2;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := tfLuminance8Alpha8ub2;
+{$ENDIF}
end;
procedure TfdLuminance8Alpha8ub2.SetValues;
fPrecision := glBitmapRec4ub(8, 8, 8, 8);
fShift := glBitmapRec4ub(0, 0, 0, 8);
fglFormat := GL_LUMINANCE_ALPHA;
- fglInternalFormat := GL_LUMINANCE8_ALPHA8;
+ fglInternalFormat := {$IFNDEF OPENGL_ES}GL_LUMINANCE8_ALPHA8{$ELSE}GL_LUMINANCE_ALPHA{$ENDIF};
fglDataFormat := GL_UNSIGNED_BYTE;
end;
fFormat := tfLuminance12Alpha4us2;
fWithAlpha := tfLuminance12Alpha4us2;
fWithoutAlpha := tfLuminance16us1;
- fOpenGLFormat := tfLuminance12Alpha4us2;
fPrecision := glBitmapRec4ub(16, 16, 16, 16);
fShift := glBitmapRec4ub( 0, 0, 0, 16);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfLuminance12Alpha4us2;
fglFormat := GL_LUMINANCE_ALPHA;
fglInternalFormat := GL_LUMINANCE12_ALPHA4;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfLuminance8Alpha8ub2;
+{$ENDIF}
end;
procedure TfdLuminance16Alpha16us2.SetValues;
fFormat := tfLuminance16Alpha16us2;
fWithAlpha := tfLuminance16Alpha16us2;
fWithoutAlpha := tfLuminance16us1;
- fOpenGLFormat := tfLuminance16Alpha16us2;
fPrecision := glBitmapRec4ub(16, 16, 16, 16);
fShift := glBitmapRec4ub( 0, 0, 0, 16);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfLuminance16Alpha16us2;
fglFormat := GL_LUMINANCE_ALPHA;
fglInternalFormat := GL_LUMINANCE16_ALPHA16;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfLuminance8Alpha8ub2;
+{$ENDIF}
end;
procedure TfdR3G3B2ub1.SetValues;
fFormat := tfR3G3B2ub1;
fWithAlpha := tfRGBA4us1;
fWithoutAlpha := tfR3G3B2ub1;
- fOpenGLFormat := tfR3G3B2ub1;
fRGBInverted := tfEmpty;
fPrecision := glBitmapRec4ub(3, 3, 2, 0);
fShift := glBitmapRec4ub(5, 2, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfR3G3B2ub1;
fglFormat := GL_RGB;
fglInternalFormat := GL_R3_G3_B2;
fglDataFormat := GL_UNSIGNED_BYTE_3_3_2;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdRGBX4us1.SetValues;
fFormat := tfRGBX4us1;
fWithAlpha := tfRGBA4us1;
fWithoutAlpha := tfRGBX4us1;
- fOpenGLFormat := tfRGBX4us1;
fRGBInverted := tfBGRX4us1;
fPrecision := glBitmapRec4ub( 4, 4, 4, 0);
fShift := glBitmapRec4ub(12, 8, 4, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfRGBX4us1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdXRGB4us1.SetValues;
fFormat := tfXRGB4us1;
fWithAlpha := tfARGB4us1;
fWithoutAlpha := tfXRGB4us1;
- fOpenGLFormat := tfXRGB4us1;
fRGBInverted := tfXBGR4us1;
fPrecision := glBitmapRec4ub(4, 4, 4, 0);
fShift := glBitmapRec4ub(8, 4, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfXRGB4us1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGB4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4_REV;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdR5G6B5us1.SetValues;
fFormat := tfR5G6B5us1;
fWithAlpha := tfRGB5A1us1;
fWithoutAlpha := tfR5G6B5us1;
- fOpenGLFormat := tfR5G6B5us1;
fRGBInverted := tfB5G6R5us1;
fPrecision := glBitmapRec4ub( 5, 6, 5, 0);
fShift := glBitmapRec4ub(11, 5, 0, 0);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
+ fOpenGLFormat := tfR5G6B5us1;
fglFormat := GL_RGB;
fglInternalFormat := GL_RGB565;
fglDataFormat := GL_UNSIGNED_SHORT_5_6_5;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$IFEND}
end;
procedure TfdRGB5X1us1.SetValues;
fFormat := tfRGB5X1us1;
fWithAlpha := tfRGB5A1us1;
fWithoutAlpha := tfRGB5X1us1;
- fOpenGLFormat := tfRGB5X1us1;
fRGBInverted := tfBGR5X1us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 0);
fShift := glBitmapRec4ub(11, 6, 1, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfRGB5X1us1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB5;
fglDataFormat := GL_UNSIGNED_SHORT_5_5_5_1;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdX1RGB5us1.SetValues;
fFormat := tfX1RGB5us1;
fWithAlpha := tfA1RGB5us1;
fWithoutAlpha := tfX1RGB5us1;
- fOpenGLFormat := tfX1RGB5us1;
fRGBInverted := tfX1BGR5us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 0);
fShift := glBitmapRec4ub(10, 5, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfX1RGB5us1;
fglFormat := GL_BGRA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB5;
fglDataFormat := GL_UNSIGNED_SHORT_1_5_5_5_REV;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdRGB8ub3.SetValues;
fFormat := tfRGB8ub3;
fWithAlpha := tfRGBA8ub4;
fWithoutAlpha := tfRGB8ub3;
- fOpenGLFormat := tfRGB8ub3;
fRGBInverted := tfBGR8ub3;
fPrecision := glBitmapRec4ub(8, 8, 8, 0);
fShift := glBitmapRec4ub(0, 8, 16, 0);
+ fOpenGLFormat := tfRGB8ub3;
fglFormat := GL_RGB;
- fglInternalFormat := GL_RGB8;
+ fglInternalFormat := {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}GL_RGB8{$ELSE}GL_RGB{$IFEND};
fglDataFormat := GL_UNSIGNED_BYTE;
end;
fFormat := tfRGBX8ui1;
fWithAlpha := tfRGBA8ui1;
fWithoutAlpha := tfRGBX8ui1;
- fOpenGLFormat := tfRGB8ub3;
fRGBInverted := tfBGRX8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 0);
fShift := glBitmapRec4ub(24, 16, 8, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfRGBX8ui1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$ENDIF}
end;
procedure TfdXRGB8ui1.SetValues;
fFormat := tfXRGB8ui1;
fWithAlpha := tfXRGB8ui1;
fWithoutAlpha := tfXRGB8ui1;
- fOpenGLFormat := tfRGB8ub3;
+ fOpenGLFormat := tfXRGB8ui1;
fRGBInverted := tfXBGR8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 0);
fShift := glBitmapRec4ub(16, 8, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfXRGB8ui1;
fglFormat := GL_BGRA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$ENDIF}
end;
procedure TfdRGB10X2ui1.SetValues;
fFormat := tfRGB10X2ui1;
fWithAlpha := tfRGB10A2ui1;
fWithoutAlpha := tfRGB10X2ui1;
- fOpenGLFormat := tfRGB10X2ui1;
fRGBInverted := tfBGR10X2ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 0);
fShift := glBitmapRec4ub(22, 12, 2, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfRGB10X2ui1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB10;
fglDataFormat := GL_UNSIGNED_INT_10_10_10_2;
+{$ELSE}
+ fOpenGLFormat := tfRGB16us3;
+{$ENDIF}
end;
procedure TfdX2RGB10ui1.SetValues;
fFormat := tfX2RGB10ui1;
fWithAlpha := tfA2RGB10ui1;
fWithoutAlpha := tfX2RGB10ui1;
- fOpenGLFormat := tfX2RGB10ui1;
fRGBInverted := tfX2BGR10ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 0);
fShift := glBitmapRec4ub(20, 10, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfX2RGB10ui1;
fglFormat := GL_BGRA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB10;
fglDataFormat := GL_UNSIGNED_INT_2_10_10_10_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGB16us3;
+{$ENDIF}
end;
procedure TfdRGB16us3.SetValues;
fFormat := tfRGB16us3;
fWithAlpha := tfRGBA16us4;
fWithoutAlpha := tfRGB16us3;
- fOpenGLFormat := tfRGB16us3;
fRGBInverted := tfBGR16us3;
fPrecision := glBitmapRec4ub(16, 16, 16, 0);
fShift := glBitmapRec4ub( 0, 16, 32, 0);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
+ fOpenGLFormat := tfRGB16us3;
fglFormat := GL_RGB;
- fglInternalFormat := GL_RGB16;
+ fglInternalFormat := {$IFNDEF OPENGL_ES}GL_RGB16{$ELSE}GL_RGB16UI{$ENDIF};
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$IFEND}
end;
procedure TfdRGBA4us1.SetValues;
fPrecision := glBitmapRec4ub( 4, 4, 4, 4);
fShift := glBitmapRec4ub(12, 8, 4, 0);
fglFormat := GL_RGBA;
- fglInternalFormat := GL_RGBA4;
+ fglInternalFormat := {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}GL_RGBA8{$ELSE}GL_RGBA{$IFEND};
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4;
end;
fFormat := tfARGB4us1;
fWithAlpha := tfARGB4us1;
fWithoutAlpha := tfXRGB4us1;
- fOpenGLFormat := tfARGB4us1;
fRGBInverted := tfABGR4us1;
fPrecision := glBitmapRec4ub( 4, 4, 4, 4);
fShift := glBitmapRec4ub( 8, 4, 0, 12);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfARGB4us1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGBA4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGBA4us1;
+{$ENDIF}
end;
procedure TfdRGB5A1us1.SetValues;
fPrecision := glBitmapRec4ub( 5, 5, 5, 1);
fShift := glBitmapRec4ub(11, 6, 1, 0);
fglFormat := GL_RGBA;
- fglInternalFormat := GL_RGB5_A1;
+ fglInternalFormat := {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}GL_RGB5_A1{$ELSE}GL_RGBA{$IFEND};
fglDataFormat := GL_UNSIGNED_SHORT_5_5_5_1;
end;
fFormat := tfA1RGB5us1;
fWithAlpha := tfA1RGB5us1;
fWithoutAlpha := tfX1RGB5us1;
- fOpenGLFormat := tfA1RGB5us1;
fRGBInverted := tfA1BGR5us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 1);
fShift := glBitmapRec4ub(10, 5, 0, 15);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfA1RGB5us1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGB5_A1;
fglDataFormat := GL_UNSIGNED_SHORT_1_5_5_5_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGB5A1us1;
+{$ENDIF}
end;
procedure TfdRGBA8ui1.SetValues;
fFormat := tfRGBA8ui1;
fWithAlpha := tfRGBA8ui1;
fWithoutAlpha := tfRGBX8ui1;
- fOpenGLFormat := tfRGBA8ui1;
fRGBInverted := tfBGRA8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 8);
fShift := glBitmapRec4ub(24, 16, 8, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfRGBA8ui1;
fglFormat := GL_RGBA;
fglInternalFormat := GL_RGBA8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ub4;
+{$ENDIF}
end;
procedure TfdARGB8ui1.SetValues;
fFormat := tfARGB8ui1;
fWithAlpha := tfARGB8ui1;
fWithoutAlpha := tfXRGB8ui1;
- fOpenGLFormat := tfARGB8ui1;
fRGBInverted := tfABGR8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 8);
fShift := glBitmapRec4ub(16, 8, 0, 24);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfARGB8ui1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGBA8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ub4;
+{$ENDIF}
end;
procedure TfdRGBA8ub4.SetValues;
fPrecision := glBitmapRec4ub( 8, 8, 8, 8);
fShift := glBitmapRec4ub( 0, 8, 16, 24);
fglFormat := GL_RGBA;
- fglInternalFormat := GL_RGBA8;
+ fglInternalFormat := {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}GL_RGBA8{$ELSE}GL_RGBA{$IFEND};
fglDataFormat := GL_UNSIGNED_BYTE;
end;
fFormat := tfRGB10A2ui1;
fWithAlpha := tfRGB10A2ui1;
fWithoutAlpha := tfRGB10X2ui1;
- fOpenGLFormat := tfRGB10A2ui1;
fRGBInverted := tfBGR10A2ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 2);
fShift := glBitmapRec4ub(22, 12, 2, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfRGB10A2ui1;
fglFormat := GL_RGBA;
fglInternalFormat := GL_RGB10_A2;
fglDataFormat := GL_UNSIGNED_INT_10_10_10_2;
+{$ELSE}
+ fOpenGLFormat := tfA2RGB10ui1;
+{$ENDIF}
end;
procedure TfdA2RGB10ui1.SetValues;
fFormat := tfA2RGB10ui1;
fWithAlpha := tfA2RGB10ui1;
fWithoutAlpha := tfX2RGB10ui1;
- fOpenGLFormat := tfA2RGB10ui1;
fRGBInverted := tfA2BGR10ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 2);
fShift := glBitmapRec4ub(20, 10, 0, 30);
+{$IF NOT DEFINED(OPENGL_ES)}
+ fOpenGLFormat := tfA2RGB10ui1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGB10_A2;
fglDataFormat := GL_UNSIGNED_INT_2_10_10_10_REV;
+{$ELSEIF DEFINED(OPENGL_ES_3_0)}
+ fOpenGLFormat := tfA2RGB10ui1;
+ fglFormat := GL_RGBA;
+ fglInternalFormat := GL_RGB10_A2;
+ fglDataFormat := GL_UNSIGNED_INT_2_10_10_10_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ui1;
+{$IFEND}
end;
procedure TfdRGBA16us4.SetValues;
fFormat := tfRGBA16us4;
fWithAlpha := tfRGBA16us4;
fWithoutAlpha := tfRGB16us3;
- fOpenGLFormat := tfRGBA16us4;
fRGBInverted := tfBGRA16us4;
fPrecision := glBitmapRec4ub(16, 16, 16, 16);
fShift := glBitmapRec4ub( 0, 16, 32, 48);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
+ fOpenGLFormat := tfRGBA16us4;
fglFormat := GL_RGBA;
- fglInternalFormat := GL_RGBA16;
+ fglInternalFormat := {$IFNDEF OPENGL_ES}GL_RGBA16{$ELSE}GL_RGBA16UI{$ENDIF};
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ub4;
+{$IFEND}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
fFormat := tfBGRX4us1;
fWithAlpha := tfBGRA4us1;
fWithoutAlpha := tfBGRX4us1;
- fOpenGLFormat := tfBGRX4us1;
fRGBInverted := tfRGBX4us1;
fPrecision := glBitmapRec4ub( 4, 4, 4, 0);
fShift := glBitmapRec4ub( 4, 8, 12, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGRX4us1;
fglFormat := GL_BGRA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdXBGR4us1.SetValues;
fFormat := tfXBGR4us1;
fWithAlpha := tfABGR4us1;
fWithoutAlpha := tfXBGR4us1;
- fOpenGLFormat := tfXBGR4us1;
fRGBInverted := tfXRGB4us1;
fPrecision := glBitmapRec4ub( 4, 4, 4, 0);
fShift := glBitmapRec4ub( 0, 4, 8, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfXBGR4us1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4_REV;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdB5G6R5us1.SetValues;
fFormat := tfB5G6R5us1;
fWithAlpha := tfBGR5A1us1;
fWithoutAlpha := tfB5G6R5us1;
- fOpenGLFormat := tfB5G6R5us1;
fRGBInverted := tfR5G6B5us1;
fPrecision := glBitmapRec4ub( 5, 6, 5, 0);
fShift := glBitmapRec4ub( 0, 5, 11, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfB5G6R5us1;
fglFormat := GL_RGB;
fglInternalFormat := GL_RGB565;
fglDataFormat := GL_UNSIGNED_SHORT_5_6_5_REV;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdBGR5X1us1.SetValues;
fFormat := tfBGR5X1us1;
fWithAlpha := tfBGR5A1us1;
fWithoutAlpha := tfBGR5X1us1;
- fOpenGLFormat := tfBGR5X1us1;
fRGBInverted := tfRGB5X1us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 0);
fShift := glBitmapRec4ub( 1, 6, 11, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGR5X1us1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGB5;
fglDataFormat := GL_UNSIGNED_SHORT_5_5_5_1;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdX1BGR5us1.SetValues;
fFormat := tfX1BGR5us1;
fWithAlpha := tfA1BGR5us1;
fWithoutAlpha := tfX1BGR5us1;
- fOpenGLFormat := tfX1BGR5us1;
fRGBInverted := tfX1RGB5us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 0);
fShift := glBitmapRec4ub( 0, 5, 10, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfX1BGR5us1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB5;
fglDataFormat := GL_UNSIGNED_SHORT_1_5_5_5_REV;
+{$ELSE}
+ fOpenGLFormat := tfR5G6B5us1;
+{$ENDIF}
end;
procedure TfdBGR8ub3.SetValues;
fFormat := tfBGR8ub3;
fWithAlpha := tfBGRA8ub4;
fWithoutAlpha := tfBGR8ub3;
- fOpenGLFormat := tfBGR8ub3;
fRGBInverted := tfRGB8ub3;
fPrecision := glBitmapRec4ub( 8, 8, 8, 0);
fShift := glBitmapRec4ub(16, 8, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGR8ub3;
fglFormat := GL_BGR;
fglInternalFormat := GL_RGB8;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$ENDIF}
end;
procedure TfdBGRX8ui1.SetValues;
fFormat := tfBGRX8ui1;
fWithAlpha := tfBGRA8ui1;
fWithoutAlpha := tfBGRX8ui1;
- fOpenGLFormat := tfBGRX8ui1;
fRGBInverted := tfRGBX8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 0);
fShift := glBitmapRec4ub( 8, 16, 24, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGRX8ui1;
fglFormat := GL_BGRA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$ENDIF}
end;
procedure TfdXBGR8ui1.SetValues;
fFormat := tfXBGR8ui1;
fWithAlpha := tfABGR8ui1;
fWithoutAlpha := tfXBGR8ui1;
- fOpenGLFormat := tfXBGR8ui1;
fRGBInverted := tfXRGB8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 0);
fShift := glBitmapRec4ub( 0, 8, 16, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfXBGR8ui1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGB8ub3;
+{$ENDIF}
end;
procedure TfdBGR10X2ui1.SetValues;
fFormat := tfBGR10X2ui1;
fWithAlpha := tfBGR10A2ui1;
fWithoutAlpha := tfBGR10X2ui1;
- fOpenGLFormat := tfBGR10X2ui1;
fRGBInverted := tfRGB10X2ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 0);
fShift := glBitmapRec4ub( 2, 12, 22, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGR10X2ui1;
fglFormat := GL_BGRA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB10;
fglDataFormat := GL_UNSIGNED_INT_10_10_10_2;
+{$ELSE}
+ fOpenGLFormat := tfRGB16us3;
+{$ENDIF}
end;
procedure TfdX2BGR10ui1.SetValues;
fFormat := tfX2BGR10ui1;
fWithAlpha := tfA2BGR10ui1;
fWithoutAlpha := tfX2BGR10ui1;
- fOpenGLFormat := tfX2BGR10ui1;
fRGBInverted := tfX2RGB10ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 0);
fShift := glBitmapRec4ub( 0, 10, 20, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfX2BGR10ui1;
fglFormat := GL_RGBA; //GL_INVALID_OPERATION if not GL_BGRA or GL_RGBA
fglInternalFormat := GL_RGB10;
fglDataFormat := GL_UNSIGNED_INT_2_10_10_10_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGB16us3;
+{$ENDIF}
end;
procedure TfdBGR16us3.SetValues;
fFormat := tfBGR16us3;
fWithAlpha := tfBGRA16us4;
fWithoutAlpha := tfBGR16us3;
- fOpenGLFormat := tfBGR16us3;
fRGBInverted := tfRGB16us3;
fPrecision := glBitmapRec4ub(16, 16, 16, 0);
fShift := glBitmapRec4ub(32, 16, 0, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGR16us3;
fglFormat := GL_BGR;
fglInternalFormat := GL_RGB16;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfRGB16us3;
+{$ENDIF}
end;
procedure TfdBGRA4us1.SetValues;
fFormat := tfBGRA4us1;
fWithAlpha := tfBGRA4us1;
fWithoutAlpha := tfBGRX4us1;
- fOpenGLFormat := tfBGRA4us1;
fRGBInverted := tfRGBA4us1;
fPrecision := glBitmapRec4ub( 4, 4, 4, 4);
fShift := glBitmapRec4ub( 4, 8, 12, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGRA4us1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGBA4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4;
+{$ELSE}
+ fOpenGLFormat := tfRGBA4us1;
+{$ENDIF}
end;
procedure TfdABGR4us1.SetValues;
fFormat := tfABGR4us1;
fWithAlpha := tfABGR4us1;
fWithoutAlpha := tfXBGR4us1;
- fOpenGLFormat := tfABGR4us1;
fRGBInverted := tfARGB4us1;
fPrecision := glBitmapRec4ub( 4, 4, 4, 4);
fShift := glBitmapRec4ub( 0, 4, 8, 12);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfABGR4us1;
fglFormat := GL_RGBA;
fglInternalFormat := GL_RGBA4;
fglDataFormat := GL_UNSIGNED_SHORT_4_4_4_4_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGBA4us1;
+{$ENDIF}
end;
procedure TfdBGR5A1us1.SetValues;
fFormat := tfBGR5A1us1;
fWithAlpha := tfBGR5A1us1;
fWithoutAlpha := tfBGR5X1us1;
- fOpenGLFormat := tfBGR5A1us1;
fRGBInverted := tfRGB5A1us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 1);
fShift := glBitmapRec4ub( 1, 6, 11, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGR5A1us1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGB5_A1;
fglDataFormat := GL_UNSIGNED_SHORT_5_5_5_1;
+{$ELSE}
+ fOpenGLFormat := tfRGB5A1us1;
+{$ENDIF}
end;
procedure TfdA1BGR5us1.SetValues;
fFormat := tfA1BGR5us1;
fWithAlpha := tfA1BGR5us1;
fWithoutAlpha := tfX1BGR5us1;
- fOpenGLFormat := tfA1BGR5us1;
fRGBInverted := tfA1RGB5us1;
fPrecision := glBitmapRec4ub( 5, 5, 5, 1);
fShift := glBitmapRec4ub( 0, 5, 10, 15);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfA1BGR5us1;
fglFormat := GL_RGBA;
fglInternalFormat := GL_RGB5_A1;
fglDataFormat := GL_UNSIGNED_SHORT_1_5_5_5_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGB5A1us1;
+{$ENDIF}
end;
procedure TfdBGRA8ui1.SetValues;
fFormat := tfBGRA8ui1;
fWithAlpha := tfBGRA8ui1;
fWithoutAlpha := tfBGRX8ui1;
- fOpenGLFormat := tfBGRA8ui1;
fRGBInverted := tfRGBA8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 8);
fShift := glBitmapRec4ub( 8, 16, 24, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGRA8ui1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGBA8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ub4;
+{$ENDIF}
end;
procedure TfdABGR8ui1.SetValues;
fFormat := tfABGR8ui1;
fWithAlpha := tfABGR8ui1;
fWithoutAlpha := tfXBGR8ui1;
- fOpenGLFormat := tfABGR8ui1;
fRGBInverted := tfARGB8ui1;
fPrecision := glBitmapRec4ub( 8, 8, 8, 8);
fShift := glBitmapRec4ub( 0, 8, 16, 24);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfABGR8ui1;
fglFormat := GL_RGBA;
fglInternalFormat := GL_RGBA8;
fglDataFormat := GL_UNSIGNED_INT_8_8_8_8_REV;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ub4
+{$ENDIF}
end;
procedure TfdBGRA8ub4.SetValues;
fFormat := tfBGRA8ub4;
fWithAlpha := tfBGRA8ub4;
fWithoutAlpha := tfBGR8ub3;
- fOpenGLFormat := tfBGRA8ub4;
fRGBInverted := tfRGBA8ub4;
fPrecision := glBitmapRec4ub( 8, 8, 8, 8);
fShift := glBitmapRec4ub(16, 8, 0, 24);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGRA8ub4;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGBA8;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := tfRGBA8ub4;
+{$ENDIF}
end;
procedure TfdBGR10A2ui1.SetValues;
fFormat := tfBGR10A2ui1;
fWithAlpha := tfBGR10A2ui1;
fWithoutAlpha := tfBGR10X2ui1;
- fOpenGLFormat := tfBGR10A2ui1;
fRGBInverted := tfRGB10A2ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 2);
fShift := glBitmapRec4ub( 2, 12, 22, 0);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGR10A2ui1;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGB10_A2;
fglDataFormat := GL_UNSIGNED_INT_10_10_10_2;
+{$ELSE}
+ fOpenGLFormat := tfA2RGB10ui1;
+{$ENDIF}
end;
procedure TfdA2BGR10ui1.SetValues;
fFormat := tfA2BGR10ui1;
fWithAlpha := tfA2BGR10ui1;
fWithoutAlpha := tfX2BGR10ui1;
- fOpenGLFormat := tfA2BGR10ui1;
fRGBInverted := tfA2RGB10ui1;
fPrecision := glBitmapRec4ub(10, 10, 10, 2);
fShift := glBitmapRec4ub( 0, 10, 20, 30);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfA2BGR10ui1;
fglFormat := GL_RGBA;
fglInternalFormat := GL_RGB10_A2;
fglDataFormat := GL_UNSIGNED_INT_2_10_10_10_REV;
+{$ELSE}
+ fOpenGLFormat := tfA2RGB10ui1;
+{$ENDIF}
end;
procedure TfdBGRA16us4.SetValues;
fFormat := tfBGRA16us4;
fWithAlpha := tfBGRA16us4;
fWithoutAlpha := tfBGR16us3;
- fOpenGLFormat := tfBGRA16us4;
fRGBInverted := tfRGBA16us4;
fPrecision := glBitmapRec4ub(16, 16, 16, 16);
fShift := glBitmapRec4ub(32, 16, 0, 48);
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfBGRA16us4;
fglFormat := GL_BGRA;
fglInternalFormat := GL_RGBA16;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$ELSE}
+ fOpenGLFormat := tfRGBA16us4;
+{$ENDIF}
end;
procedure TfdDepth16us1.SetValues;
fBitsPerPixel := 16;
fFormat := tfDepth16us1;
fWithoutAlpha := tfDepth16us1;
- fOpenGLFormat := tfDepth16us1;
fPrecision := glBitmapRec4ub(16, 16, 16, 16);
fShift := glBitmapRec4ub( 0, 0, 0, 0);
+{$IF NOT DEFINED (OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
+ fOpenGLFormat := tfDepth16us1;
fglFormat := GL_DEPTH_COMPONENT;
fglInternalFormat := GL_DEPTH_COMPONENT16;
fglDataFormat := GL_UNSIGNED_SHORT;
+{$IFEND}
end;
procedure TfdDepth24ui1.SetValues;
fOpenGLFormat := tfDepth24ui1;
fPrecision := glBitmapRec4ub(32, 32, 32, 32);
fShift := glBitmapRec4ub( 0, 0, 0, 0);
+{$IF NOT DEFINED (OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
+ fOpenGLFormat := tfDepth24ui1;
fglFormat := GL_DEPTH_COMPONENT;
fglInternalFormat := GL_DEPTH_COMPONENT24;
fglDataFormat := GL_UNSIGNED_INT;
+{$IFEND}
end;
procedure TfdDepth32ui1.SetValues;
fBitsPerPixel := 32;
fFormat := tfDepth32ui1;
fWithoutAlpha := tfDepth32ui1;
- fOpenGLFormat := tfDepth32ui1;
fPrecision := glBitmapRec4ub(32, 32, 32, 32);
fShift := glBitmapRec4ub( 0, 0, 0, 0);
+{$IF NOT DEFINED(OPENGL_ES)}
+ fOpenGLFormat := tfDepth32ui1;
fglFormat := GL_DEPTH_COMPONENT;
fglInternalFormat := GL_DEPTH_COMPONENT32;
fglDataFormat := GL_UNSIGNED_INT;
+{$ELSEIF DEFINED(OPENGL_ES_3_0)}
+ fOpenGLFormat := tfDepth24ui1;
+{$ELSEIF DEFINED(OPENGL_ES_2_0)}
+ fOpenGLFormat := tfDepth16us1;
+{$IFEND}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inherited SetValues;
fFormat := tfS3tcDtx1RGBA;
fWithAlpha := tfS3tcDtx1RGBA;
- fOpenGLFormat := tfS3tcDtx1RGBA;
fUncompressed := tfRGB5A1us1;
fBitsPerPixel := 4;
fIsCompressed := true;
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfS3tcDtx1RGBA;
fglFormat := GL_COMPRESSED_RGBA;
fglInternalFormat := GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := fUncompressed;
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inherited SetValues;
fFormat := tfS3tcDtx3RGBA;
fWithAlpha := tfS3tcDtx3RGBA;
- fOpenGLFormat := tfS3tcDtx3RGBA;
fUncompressed := tfRGBA8ub4;
fBitsPerPixel := 8;
fIsCompressed := true;
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfS3tcDtx3RGBA;
fglFormat := GL_COMPRESSED_RGBA;
fglInternalFormat := GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := fUncompressed;
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inherited SetValues;
fFormat := tfS3tcDtx3RGBA;
fWithAlpha := tfS3tcDtx3RGBA;
- fOpenGLFormat := tfS3tcDtx3RGBA;
fUncompressed := tfRGBA8ub4;
fBitsPerPixel := 8;
fIsCompressed := true;
+{$IFNDEF OPENGL_ES}
+ fOpenGLFormat := tfS3tcDtx3RGBA;
fglFormat := GL_COMPRESSED_RGBA;
fglInternalFormat := GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
fglDataFormat := GL_UNSIGNED_BYTE;
+{$ELSE}
+ fOpenGLFormat := fUncompressed;
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.SetAnisotropic(const aValue: Integer);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_EXT)}
var
MaxAnisotropic: Integer;
+{$IFEND}
begin
fAnisotropic := aValue;
if (ID > 0) then begin
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_EXT)}
if GL_EXT_texture_filter_anisotropic then begin
if fAnisotropic > 0 then begin
Bind(false);
end else begin
fAnisotropic := 0;
end;
+{$ELSE}
+ fAnisotropic := 0;
+{$IFEND}
end;
end;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-procedure TglBitmap.SetupParameters(out aBuildWithGlu: Boolean);
+procedure TglBitmap.SetupParameters({$IFNDEF OPENGL_ES}out aBuildWithGlu: Boolean{$ENDIF});
begin
// Set Up Parameters
SetWrap(fWrapS, fWrapT, fWrapR);
SetFilter(fFilterMin, fFilterMag);
SetAnisotropic(fAnisotropic);
- SetBorderColor(fBorderColor[0], fBorderColor[1], fBorderColor[2], fBorderColor[3]);
+{$IFNDEF OPENGL_ES}
+ SetBorderColor(fBorderColor[0], fBorderColor[1], fBorderColor[2], fBorderColor[3]);
if (GL_ARB_texture_swizzle or GL_EXT_texture_swizzle or GL_VERSION_3_3) then
SetSwizzle(fSwizzle[0], fSwizzle[1], fSwizzle[2], fSwizzle[3]);
+{$ENDIF}
+{$IFNDEF OPENGL_ES}
// Mip Maps Generation Mode
aBuildWithGlu := false;
if (MipMap = mmMipmap) then begin
aBuildWithGlu := true;
end else if (MipMap = mmMipmapGlu) then
aBuildWithGlu := true;
+{$ELSE}
+ if (MipMap = mmMipmap) then
+ glTexParameteri(Target, GL_GENERATE_MIPMAP, GL_TRUE);
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
fID := 0;
fTarget := 0;
+{$IFNDEF OPENGL_ES}
fIsResident := false;
+{$ENDIF}
fMipMap := glBitmapDefaultMipmap;
fFreeDataAfterGenTexture := glBitmapGetDefaultFreeDataAfterGenTexture;
glBitmapGetDefaultFilter (fFilterMin, fFilterMag);
glBitmapGetDefaultTextureWrap(fWrapS, fWrapT, fWrapR);
+{$IFNDEF OPENGL_ES}
glBitmapGetDefaultSwizzle (fSwizzle[0], fSwizzle[1], fSwizzle[2], fSwizzle[3]);
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(Byte(aUseRGB) and 1) ));
end;
+{$IFNDEF OPENGL_ES}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.SetBorderColor(const aRed, aGreen, aBlue, aAlpha: Single);
begin
glTexParameterfv(Target, GL_TEXTURE_BORDER_COLOR, @fBorderColor[0]);
end;
end;
+{$ENDIF}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.FreeData;
Bind(false);
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, fFilterMag);
- if (MipMap = mmNone) or (Target = GL_TEXTURE_RECTANGLE) then begin
+ if (MipMap = mmNone) {$IFNDEF OPENGL_ES}or (Target = GL_TEXTURE_RECTANGLE){$ENDIF} then begin
case fFilterMin of
GL_NEAREST, GL_LINEAR:
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, fFilterMin);
procedure CheckAndSetWrap(const aValue: Cardinal; var aTarget: Cardinal);
begin
case aValue of
+{$IFNDEF OPENGL_ES}
GL_CLAMP:
aTarget := GL_CLAMP;
+{$ENDIF}
GL_REPEAT:
aTarget := GL_REPEAT;
GL_CLAMP_TO_EDGE: begin
- if GL_VERSION_1_2 or GL_EXT_texture_edge_clamp then
- aTarget := GL_CLAMP_TO_EDGE
+{$IFNDEF OPENGL_ES}
+ if not GL_VERSION_1_2 and not GL_EXT_texture_edge_clamp then
+ aTarget := GL_CLAMP
else
- aTarget := GL_CLAMP;
+{$ENDIF}
+ aTarget := GL_CLAMP_TO_EDGE;
end;
+{$IFNDEF OPENGL_ES}
GL_CLAMP_TO_BORDER: begin
if GL_VERSION_1_3 or GL_ARB_texture_border_clamp then
aTarget := GL_CLAMP_TO_BORDER
else
aTarget := GL_CLAMP;
end;
+{$ENDIF}
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
GL_MIRRORED_REPEAT: begin
+ {$IFNDEF OPENGL_ES}
if GL_VERSION_1_4 or GL_ARB_texture_mirrored_repeat or GL_IBM_texture_mirrored_repeat then
+ {$ELSE}
+ if GL_VERSION_2_0 then
+ {$ENDIF}
aTarget := GL_MIRRORED_REPEAT
else
raise EglBitmap.Create('SetWrap - Unsupported Texturewrap GL_MIRRORED_REPEAT (S).');
end;
+{$IFEND}
else
raise EglBitmap.Create('SetWrap - Unknow Texturewrap');
end;
Bind(false);
glTexParameteri(Target, GL_TEXTURE_WRAP_S, fWrapS);
glTexParameteri(Target, GL_TEXTURE_WRAP_T, fWrapT);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
+ {$IFDEF OPENGL_ES} if GL_VERSION_3_0 then{$ENDIF}
glTexParameteri(Target, GL_TEXTURE_WRAP_R, fWrapR);
+{$IFEND}
end;
end;
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.SetSwizzle(const r, g, b, a: GLenum);
end;
begin
+{$IFNDEF OPENGL_ES}
if not (GL_ARB_texture_swizzle or GL_EXT_texture_swizzle or GL_VERSION_3_3) then
raise EglBitmapNotSupported.Create('texture swizzle is not supported');
+{$ELSE}
+ if not GL_VERSION_3_0 then
+ raise EglBitmapNotSupported.Create('texture swizzle is not supported');
+{$ENDIF}
CheckAndSetValue(r, 0);
CheckAndSetValue(g, 1);
CheckAndSetValue(b, 2);
if (ID > 0) then begin
Bind(false);
+{$IFNDEF OPENGL_ES}
glTexParameteriv(Target, GL_TEXTURE_SWIZZLE_RGBA, PGLint(@fSwizzle[0]));
+{$ELSE}
+ glTexParameteriv(Target, GL_TEXTURE_SWIZZLE_R, PGLint(@fSwizzle[0]));
+ glTexParameteriv(Target, GL_TEXTURE_SWIZZLE_G, PGLint(@fSwizzle[1]));
+ glTexParameteriv(Target, GL_TEXTURE_SWIZZLE_B, PGLint(@fSwizzle[2]));
+ glTexParameteriv(Target, GL_TEXTURE_SWIZZLE_A, PGLint(@fSwizzle[3]));
+{$ENDIF}
end;
end;
+{$IFEND}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.Bind(const aEnableTextureUnit: Boolean);
aStream.Write(Data^, FormatDesc.GetSize(Dimension));
end;
+{$IFNDEF OPENGL_ES}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglBitmap1D/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
begin
// Upload data
FormatDesc := TFormatDescriptor.Get(Format);
+ if (FormatDesc.glInternalFormat = 0) or (FormatDesc.glDataFormat = 0) then
+ raise EglBitmap.Create('format is not supported by video adapter, please convert before uploading data');
+
if FormatDesc.IsCompressed then begin
if not Assigned(glCompressedTexImage1D) then
raise EglBitmap.Create('compressed formats not supported by video adapter');
inherited;
Target := GL_TEXTURE_1D;
end;
+{$ENDIF}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglBitmap2D/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-procedure TglBitmap2D.UploadData(const aTarget: GLenum; const aBuildWithGlu: Boolean);
+procedure TglBitmap2D.UploadData(const aTarget: GLenum{$IFNDEF OPENGL_ES}; const aBuildWithGlu: Boolean{$ENDIF});
var
FormatDesc: TFormatDescriptor;
begin
+ FormatDesc := TFormatDescriptor.Get(Format);
+ if (FormatDesc.glInternalFormat = 0) or (FormatDesc.glDataFormat = 0) then
+ raise EglBitmap.Create('format is not supported by video adapter, please convert before uploading data');
+
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- FormatDesc := TFormatDescriptor.Get(Format);
if FormatDesc.IsCompressed then begin
if not Assigned(glCompressedTexImage2D) then
raise EglBitmap.Create('compressed formats not supported by video adapter');
glCompressedTexImage2D(aTarget, 0, FormatDesc.glInternalFormat, Width, Height, 0, FormatDesc.GetSize(fDimension), Data)
+{$IFNDEF OPENGL_ES}
end else if aBuildWithGlu then begin
gluBuild2DMipmaps(aTarget, FormatDesc.ChannelCount, Width, Height,
FormatDesc.glFormat, FormatDesc.glDataFormat, Data)
+{$ENDIF}
end else begin
glTexImage2D(aTarget, 0, FormatDesc.glInternalFormat, Width, Height, 0,
FormatDesc.glFormat, FormatDesc.glDataFormat, Data);
end;
end;
+{$IFNDEF OPENGL_ES}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap2D.GetDataFromTexture;
var
raise;
end;
end;
+{$ENDIF}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap2D.GenTexture(const aTestTextureSize: Boolean);
var
- BuildWithGlu, PotTex, TexRec: Boolean;
+ {$IFNDEF OPENGL_ES}
+ BuildWithGlu, TexRec: Boolean;
+ {$ENDIF}
+ PotTex: Boolean;
TexSize: Integer;
begin
if Assigned(Data) then begin
raise EglBitmapSizeToLarge.Create('TglBitmap2D.GenTexture - The size for the texture is to large. It''s may be not conform with the Hardware.');
PotTex := IsPowerOfTwo(Height) and IsPowerOfTwo(Width);
+{$IF NOT DEFINED(OPENGL_ES)}
TexRec := (GL_ARB_texture_rectangle or GL_EXT_texture_rectangle or GL_NV_texture_rectangle) and (Target = GL_TEXTURE_RECTANGLE);
if not (PotTex or GL_ARB_texture_non_power_of_two or GL_VERSION_2_0 or TexRec) then
raise EglBitmapNonPowerOfTwo.Create('TglBitmap2D.GenTexture - Rendercontex dosn''t support non power of two texture.');
+{$ELSEIF DEFINED(OPENGL_ES_EXT)}
+ if not PotTex and not GL_OES_texture_npot then
+ raise EglBitmapNonPowerOfTwo.Create('TglBitmap2D.GenTexture - Rendercontex dosn''t support non power of two texture.');
+{$ELSE}
+ if not PotTex then
+ raise EglBitmapNonPowerOfTwo.Create('TglBitmap2D.GenTexture - Rendercontex dosn''t support non power of two texture.');
+{$IFEND}
end;
CreateId;
- SetupParameters(BuildWithGlu);
- UploadData(Target, BuildWithGlu);
+ SetupParameters({$IFNDEF OPENGL_ES}BuildWithGlu{$ENDIF});
+ UploadData(Target{$IFNDEF OPENGL_ES}, BuildWithGlu{$ENDIF});
+{$IFNDEF OPENGL_ES}
glAreTexturesResident(1, @fID, @fIsResident);
+{$ENDIF}
end;
end;
end;
end;
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglBitmapCubeMap////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
begin
inherited;
+{$IFNDEF OPENGL_ES}
if not (GL_VERSION_1_3 or GL_ARB_texture_cube_map or GL_EXT_texture_cube_map) then
raise EglBitmap.Create('TglBitmapCubeMap.AfterConstruction - CubeMaps are unsupported.');
+{$ELSE}
+ if not (GL_VERSION_2_0) then
+ raise EglBitmap.Create('TglBitmapCubeMap.AfterConstruction - CubeMaps are unsupported.');
+{$ENDIF}
SetWrap;
Target := GL_TEXTURE_CUBE_MAP;
+{$IFNDEF OPENGL_ES}
fGenMode := GL_REFLECTION_MAP;
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmapCubeMap.GenerateCubeMap(const aCubeTarget: Cardinal; const aTestTextureSize: Boolean);
var
+ {$IFNDEF OPENGL_ES}
BuildWithGlu: Boolean;
+ {$ENDIF}
TexSize: Integer;
begin
if (aTestTextureSize) then begin
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, @TexSize);
if (Height > TexSize) or (Width > TexSize) then
- raise EglBitmapSizeToLarge.Create('TglBitmapCubeMap.GenTexture - The size for the Cubemap is to large. It''s may be not conform with the Hardware.');
+ raise EglBitmapSizeToLarge.Create('TglBitmapCubeMap.GenerateCubeMap - The size for the Cubemap is to large. It''s may be not conform with the Hardware.');
+{$IF NOT DEFINED(OPENGL_ES)}
if not ((IsPowerOfTwo(Height) and IsPowerOfTwo(Width)) or GL_VERSION_2_0 or GL_ARB_texture_non_power_of_two) then
- raise EglBitmapNonPowerOfTwo.Create('TglBitmapCubeMap.GenTexture - Cubemaps dosn''t support non power of two texture.');
+ raise EglBitmapNonPowerOfTwo.Create('TglBitmapCubeMap.GenerateCubeMap - Cubemaps dosn''t support non power of two texture.');
+{$ELSEIF DEFINED(OPENGL_ES_EXT)}
+ if not (IsPowerOfTwo(Height) and IsPowerOfTwo(Width)) and not GL_OES_texture_npot then
+ raise EglBitmapNonPowerOfTwo.Create('TglBitmapCubeMap.GenerateCubeMap - Cubemaps dosn''t support non power of two texture.');
+{$ELSE}
+ if not (IsPowerOfTwo(Height) and IsPowerOfTwo(Width)) then
+ raise EglBitmapNonPowerOfTwo.Create('TglBitmapCubeMap.GenerateCubeMap - Cubemaps dosn''t support non power of two texture.');
+{$IFEND}
end;
if (ID = 0) then
CreateID;
- SetupParameters(BuildWithGlu);
- UploadData(aCubeTarget, BuildWithGlu);
+ SetupParameters({$IFNDEF OPENGL_ES}BuildWithGlu{$ENDIF});
+ UploadData(aCubeTarget{$IFNDEF OPENGL_ES}, BuildWithGlu{$ENDIF});
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-procedure TglBitmapCubeMap.Bind(const aEnableTexCoordsGen: Boolean; const aEnableTextureUnit: Boolean);
+procedure TglBitmapCubeMap.Bind({$IFNDEF OPENGL_ES}const aEnableTexCoordsGen: Boolean;{$ENDIF} const aEnableTextureUnit: Boolean);
begin
inherited Bind (aEnableTextureUnit);
+{$IFNDEF OPENGL_ES}
if aEnableTexCoordsGen then begin
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, fGenMode);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, fGenMode);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
end;
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-procedure TglBitmapCubeMap.Unbind(const aDisableTexCoordsGen: Boolean; const aDisableTextureUnit: Boolean);
+procedure TglBitmapCubeMap.Unbind({$IFNDEF OPENGL_ES}const aDisableTexCoordsGen: Boolean;{$ENDIF} const aDisableTextureUnit: Boolean);
begin
inherited Unbind(aDisableTextureUnit);
+{$IFNDEF OPENGL_ES}
if aDisableTexCoordsGen then begin
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
end;
+{$ENDIF}
end;
+{$IFEND}
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_2_0)}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglBitmapNormalMap//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Func: TglBitmapNormalMapGetVectorFunc;
end;
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure glBitmapNormalMapPosX(out aVec: TVec; const aPosition: TglBitmapPixelPosition; const aHalfSize: Integer);
begin
aVec[0] := aHalfSize;
procedure TglBitmapNormalMap.AfterConstruction;
begin
inherited;
+{$IFNDEF OPENGL_ES}
fGenMode := GL_NORMAL_MAP;
+{$ENDIF}
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LoadFromFunc(SizeRec, glBitmapNormalMapFunc, tfBGR8ub3, @Rec);
GenerateCubeMap(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, aTestTextureSize);
end;
-
+{$IFEND}
initialization
glBitmapSetDefaultFormat (tfEmpty);
glBitmapSetDefaultMipmap (mmMipmap);
glBitmapSetDefaultFilter (GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
glBitmapSetDefaultWrap (GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
+{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
glBitmapSetDefaultSwizzle(GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA);
+{$IFEND}
glBitmapSetDefaultFreeDataAfterGenTexture(true);
glBitmapSetDefaultDeleteTextureOnFree (true);
glbFreeLibrary(GLU_LibHandle);
FreeAndNil(InitOpenGLCS);
{$ENDIF}
-{$ENDIF}
+{$ENDIF}
end.