Currently I`m using your imagelib for loading my textures in the Genesis
Device engine. Works great and loads my textures very fast. Currently I`m
implementing detail settings for the engine. Because my terrain can use
mosaik textures it can eat up a lot of video memory and a texture
detailsettings is needed. My testmap for example uses 64 textures of 1k x
1k:). I created a version of your LoadGLTextureFromFile that can load the
texture with smaller dimensions to save memory.
function LoadTextureFromFile( aFileName: string; aDetail :
TGDTextureDetail ): GLuint;
var
iImagesArray : TDynImageDataArray;
iWidth, iHeight : Integer;
begin
if LoadMultiImageFromFile(aFileName, iImagesArray) and
(Length(iImagesArray) > 0) then
begin
case aDetail of
TD_LOW : begin
iWidth := Round( iImagesArray[0].Width * 0.50 );
iHeight := Round( iImagesArray[0].Height * 0.50 );
end;
TD_MEDIUM : begin
iWidth := Round( iImagesArray[0].Width * 0.75 );
iHeight := Round( iImagesArray[0].Height * 0.75 );
end;
TD_HIGH : begin
iWidth := iImagesArray[0].Width;
iHeight := iImagesArray[0].Height;
end;
end;
Result := CreateGLTextureFromMultiImage(iImagesArray, iWidth, iHeight,
True, ifUnknown);
end
else
Result := 0;
FreeImagesInArray(iImagesArray);
end;
It works ok but it`s very slow for Low an medium. This because textures
are rescaled, mipmaps are regenerated enz. Since I`m already using dds
textures with mipmaps and compression I was wondering if you could expand
the ImagingOpenGL.pas with some settings which lets you choose from which
mipmap level you want to start loading. Something like this:
case aDetail of
TD_LOW : Start loading to GFX card at iImagesArray[2];
TD_MEDIUM : Start loading to GFX card at iImagesArray[1];
TD_HIGH : Start loading to GFX card at iImagesArray[0];
end;
This would lead of course to smaller textureload with much faster loading:).
I played a bit arround with the CreateGLTextureFromMultiImage to do just
that but without any results.
Thanks in advance.