Explorar el Código

Merge remote-tracking branch 'glBitmap@DGL/master'

Conflicts:
	uglcBitmap.pas
master
Bergmann89 hace 11 años
padre
commit
d7f77c99ad
Se han modificado 1 ficheros con 20 adiciones y 16 borrados
  1. +20
    -16
      uglcBitmap.pas

+ 20
- 16
uglcBitmap.pas Ver fichero

@@ -1063,11 +1063,11 @@ type
public public
{ bind texture { bind texture
@param aEnableTextureUnit enable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D)) } @param aEnableTextureUnit enable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D)) }
procedure Bind(const aEnableTextureUnit: Boolean = true); virtual;
procedure Bind({$IFNDEF OPENGL_ES}const aEnableTextureUnit: Boolean = true{$ENDIF}); virtual;


{ bind texture { bind texture
@param aDisableTextureUnit disable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D)) } @param aDisableTextureUnit disable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D)) }
procedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;
procedure Unbind({$IFNDEF OPENGL_ES}const aDisableTextureUnit: Boolean = true{$ENDIF}); virtual;


{ upload texture data from given data object to video card { upload texture data from given data object to video card
@param aData texture data object that contains the actual data @param aData texture data object that contains the actual data
@@ -1180,12 +1180,12 @@ type
{ bind texture { bind texture
@param aEnableTexCoordsGen enable cube map generator @param aEnableTexCoordsGen enable cube map generator
@param aEnableTextureUnit enable texture unit } @param aEnableTextureUnit enable texture unit }
procedure Bind({$IFNDEF OPENGL_ES}const aEnableTexCoordsGen: Boolean = true;{$ENDIF} const aEnableTextureUnit: Boolean = true); reintroduce; virtual;
procedure Bind({$IFNDEF OPENGL_ES}const aEnableTexCoordsGen: Boolean = true; const aEnableTextureUnit: Boolean = true{$ENDIF}); reintroduce; virtual;


{ unbind texture { unbind texture
@param aDisableTexCoordsGen disable cube map generator @param aDisableTexCoordsGen disable cube map generator
@param aDisableTextureUnit disable texture unit } @param aDisableTextureUnit disable texture unit }
procedure Unbind({$IFNDEF OPENGL_ES}const aDisableTexCoordsGen: Boolean = true;{$ENDIF} const aDisableTextureUnit: Boolean = true); reintroduce; virtual;
procedure Unbind({$IFNDEF OPENGL_ES}const aDisableTexCoordsGen: Boolean = true; const aDisableTextureUnit: Boolean = true{$ENDIF}); reintroduce; virtual;
end; end;
{$IFEND} {$IFEND}


@@ -8122,7 +8122,7 @@ begin
{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_EXT)} {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_EXT)}
if GL_EXT_texture_filter_anisotropic then begin if GL_EXT_texture_filter_anisotropic then begin
if fAnisotropic > 0 then begin if fAnisotropic > 0 then begin
Bind(false);
Bind({$IFNDEF OPENGL_ES}false{$ENDIF});
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, @MaxAnisotropic); glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, @MaxAnisotropic);
if aValue > MaxAnisotropic then if aValue > MaxAnisotropic then
fAnisotropic := MaxAnisotropic; fAnisotropic := MaxAnisotropic;
@@ -8143,7 +8143,7 @@ begin
if (ID <> 0) then if (ID <> 0) then
glDeleteTextures(1, @fID); glDeleteTextures(1, @fID);
glGenTextures(1, @fID); glGenTextures(1, @fID);
Bind(false);
Bind({$IFNDEF OPENGL_ES}false{$ENDIF});
end; end;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -8172,7 +8172,7 @@ begin
aBuildWithGlu := true; aBuildWithGlu := true;
{$ELSE} {$ELSE}
if (MipMap = mmMipmap) then if (MipMap = mmMipmap) then
glTexParameteri(Target, GL_GENERATE_MIPMAP, GLint(GL_TRUE));
glGenerateMipmap(Target);
{$ENDIF} {$ENDIF}
end; end;


@@ -8255,7 +8255,7 @@ begin


//apply filter //apply filter
if (ID > 0) then begin if (ID > 0) then begin
Bind(false);
Bind({$IFNDEF OPENGL_ES}false{$ENDIF});
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, fFilterMag); glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, fFilterMag);


if (MipMap = mmNone) {$IFNDEF OPENGL_ES}or (Target = GL_TEXTURE_RECTANGLE){$ENDIF} then begin if (MipMap = mmNone) {$IFNDEF OPENGL_ES}or (Target = GL_TEXTURE_RECTANGLE){$ENDIF} then begin
@@ -8327,7 +8327,7 @@ begin
CheckAndSetWrap(R, fWrapR); CheckAndSetWrap(R, fWrapR);


if (ID > 0) then begin if (ID > 0) then begin
Bind(false);
Bind({$IFNDEF OPENGL_ES}false{$ENDIF});
glTexParameteri(Target, GL_TEXTURE_WRAP_S, fWrapS); glTexParameteri(Target, GL_TEXTURE_WRAP_S, fWrapS);
glTexParameteri(Target, GL_TEXTURE_WRAP_T, fWrapT); glTexParameteri(Target, GL_TEXTURE_WRAP_T, fWrapT);
{$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)} {$IF NOT DEFINED(OPENGL_ES) OR DEFINED(OPENGL_ES_3_0)}
@@ -8378,19 +8378,23 @@ end;
{$IFEND} {$IFEND}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.Bind(const aEnableTextureUnit: Boolean);
procedure TglBitmap.Bind({$IFNDEF OPENGL_ES}const aEnableTextureUnit: Boolean{$ENDIF});
begin begin
{$IFNDEF OPENGL_ES}
if aEnableTextureUnit then if aEnableTextureUnit then
glEnable(Target); glEnable(Target);
{$ENDIF}
if (ID > 0) then if (ID > 0) then
glBindTexture(Target, ID); glBindTexture(Target, ID);
end; end;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap.Unbind(const aDisableTextureUnit: Boolean);
procedure TglBitmap.Unbind({$IFNDEF OPENGL_ES}const aDisableTextureUnit: Boolean{$ENDIF});
begin begin
{$IFNDEF OPENGL_ES}
if aDisableTextureUnit then if aDisableTextureUnit then
glDisable(Target); glDisable(Target);
{$ENDIF}
glBindTexture(Target, 0); glBindTexture(Target, 0);
end; end;


@@ -8531,7 +8535,7 @@ end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglBitmap2D///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //TglBitmap2D/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmap2D.UploadDataIntern(const aDataObj: TglBitmapData; const aTarget: GLenum; const aBuildWithGlu: Boolean);
procedure TglBitmap2D.UploadDataIntern(const aDataObj: TglBitmapData; const aTarget: GLenum{$IFNDEF OPENGL_ES}; const aBuildWithGlu: Boolean{$ENDIF});
var var
fd: TglBitmapFormatDescriptor; fd: TglBitmapFormatDescriptor;
begin begin
@@ -8696,9 +8700,9 @@ begin
end; end;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmapCubeMap.Bind({$IFNDEF OPENGL_ES}const aEnableTexCoordsGen: Boolean;{$ENDIF} const aEnableTextureUnit: Boolean);
procedure TglBitmapCubeMap.Bind({$IFNDEF OPENGL_ES}const aEnableTexCoordsGen: Boolean; const aEnableTextureUnit: Boolean{$ENDIF});
begin begin
inherited Bind (aEnableTextureUnit);
inherited Bind({$IFNDEF OPENGL_ES}aEnableTextureUnit{$ENDIF});
{$IFNDEF OPENGL_ES} {$IFNDEF OPENGL_ES}
if aEnableTexCoordsGen then begin if aEnableTexCoordsGen then begin
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, fGenMode); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, fGenMode);
@@ -8712,9 +8716,9 @@ begin
end; end;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TglBitmapCubeMap.Unbind({$IFNDEF OPENGL_ES}const aDisableTexCoordsGen: Boolean;{$ENDIF} const aDisableTextureUnit: Boolean);
procedure TglBitmapCubeMap.Unbind({$IFNDEF OPENGL_ES}const aDisableTexCoordsGen: Boolean; const aDisableTextureUnit: Boolean{$ENDIF});
begin begin
inherited Unbind(aDisableTextureUnit);
inherited Unbind({$IFNDEF OPENGL_ES}aDisableTextureUnit{$ENDIF});
{$IFNDEF OPENGL_ES} {$IFNDEF OPENGL_ES}
if aDisableTexCoordsGen then begin if aDisableTexCoordsGen then begin
glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_S);


Cargando…
Cancelar
Guardar