New! Support for many texture compression methods on GPU, in particular for GPU compression formats popular on Android devices. And improvements to handle GPU compressed textures throughout the whole engine. This allows to squeeze much more texture data into a GPU memory on Android/iOS, and in general makes using GPU compressed textures much easier.
- New GPU compressed formats handled, see TGPUCompression enum type: http://michalis.ii.uni.wroc.pl/castle-engine-snapshots/docs/reference/html/CastleImages.html#TGPUCompression . We now cover popular compression formats on both OpenGL and OpenGL ES (Android, iOS). Previously we supported only S3TC.
- API improvements: All of previous S3TC-specific types and functions are extended to handle a much wider range of GPU compression types. And many more functions now accept GPU-compressed images, not just TCastleImage.
To use the compressed textures:
1. If you want to assume that the user graphic card will just be able to handle your GPU compression, then simply use the compressed textures.
They can be packed in DDS format. Be sure to flip them vertically (the engine can only automatically flip S3TC data, for the rest you have to manually flip them). We plan to implemt Khronos KTX format in the future to make this whole flipping mess obsolete.
2. To be prepared for various GPUs, you want to keep various versions of your textures (uncompressed, and maybe compressed with various algorithms). And use CastleImage.LoadImagePreprocess http://michalis.ii.uni.wroc.pl/castle-engine-snapshots/docs/reference/html/CastleImages.html#LoadImagePreprocess to redirect all image loading to use your compressed versions. Like the snippet below:
-------------------------
uses ...,
CastleURIUtils, CastleGLUtils,
CastleLog, CastleStringUtils,
CastleFilesUtils, CastleWarnings;
procedure GPUTextureAlternative(var ImageUrl: string);
begin
if IsPrefix(ApplicationData('animation/dragon/'), ImageUrl) then
begin
if GLFeatures = nil then
OnWarning(wtMinor, 'GPUCompression', 'Cannot determine whether to use GPU compressed version for ' + ImageUrl + ' because the image is loaded before GPU capabilities are known') else
if tcPvrtc1_4bpp_RGBA in
GLFeatures.TextureCompression then
begin
ImageUrl :=
ExtractURIPath(ImageUrl) +
'compressed/pvrtc1_4bpp_rgba/' +
ExtractURIName(ImageUrl) + '.dds';
WritelnLog('GPUCompression',
'Using compressed alternative ' + ImageUrl);
end;
end;
end;
initialization
LoadImagePreprocess :=@GPUTextureAlternative;
end.
-------------------------
#gameengine#dds#pvrtc#atitc#gpu#texturecompression
- New GPU compressed formats handled, see TGPUCompression enum type: http://michalis.ii.uni.wroc.pl/castle-engine-snapshots/docs/reference/html/CastleImages.html#TGPUCompression . We now cover popular compression formats on both OpenGL and OpenGL ES (Android, iOS). Previously we supported only S3TC.
- API improvements: All of previous S3TC-specific types and functions are extended to handle a much wider range of GPU compression types. And many more functions now accept GPU-compressed images, not just TCastleImage.
To use the compressed textures:
1. If you want to assume that the user graphic card will just be able to handle your GPU compression, then simply use the compressed textures.
They can be packed in DDS format. Be sure to flip them vertically (the engine can only automatically flip S3TC data, for the rest you have to manually flip them). We plan to implemt Khronos KTX format in the future to make this whole flipping mess obsolete.
2. To be prepared for various GPUs, you want to keep various versions of your textures (uncompressed, and maybe compressed with various algorithms). And use CastleImage.LoadImagePreprocess http://michalis.ii.uni.wroc.pl/castle-engine-snapshots/docs/reference/html/CastleImages.html#LoadImagePreprocess to redirect all image loading to use your compressed versions. Like the snippet below:
-------------------------
uses ...,
CastleURIUtils, CastleGLUtils,
CastleLog, CastleStringUtils,
CastleFilesUtils, CastleWarnings;
procedure GPUTextureAlternative(var ImageUrl: string);
begin
if IsPrefix(ApplicationData('animation/dragon/'), ImageUrl) then
begin
if GLFeatures = nil then
OnWarning(wtMinor, 'GPUCompression', 'Cannot determine whether to use GPU compressed version for ' + ImageUrl + ' because the image is loaded before GPU capabilities are known') else
if tcPvrtc1_4bpp_RGBA in
GLFeatures.TextureCompression then
begin
ImageUrl :=
ExtractURIPath(ImageUrl) +
'compressed/pvrtc1_4bpp_rgba/' +
ExtractURIName(ImageUrl) + '.dds';
WritelnLog('GPUCompression',
'Using compressed alternative ' + ImageUrl);
end;
end;
end;
initialization
LoadImagePreprocess :=@GPUTextureAlternative;
end.
-------------------------
#gameengine#dds#pvrtc#atitc#gpu#texturecompression