I've been interested to explore more about GLScene, but didn't have time for it. Today, using OPM I installed GLScene but almost all the demos and examples failed to run properly.
Where should I report the bug? Here or on GLScene's forum?
The very first bug and the most important one is the name case issue. This below is the
original code of SetGLSceneMediaDir in
GLUtils.pas, which is
buggy:
Function SetGLSceneMediaDir:string;
var
path: UTF8String;
p: integer;
begin
result:='';
// We need to lower case path because the functions are case sensible
// path := lowercase(ExtractFilePath(ParamStrUTF8(0)));
path := lowercase(ExtractFilePath(ParamStr(0)));
p := Pos('samples', path);
Delete(path, p + 7, Length(path));
path := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(path) + 'media');
SetCurrentDir(path);
// SetCurrentDirUTF8(path) --> NOT WORKING ON W10 64Bits !
// We need to store the result in a global var "MediaPath"
// The function SetCurrentDirUTF8 return TRUE but we are always in the application's folder
// NB These functions provide from LazFileUtils unit and not from deprecated functions in FileUtils unit.
MediaPath:=Path ;
result:=path;
end;
Remove the lowercase function and make the S uppercase in '
samples', will make it works on Linux:
function SetGLSceneMediaDir:string;
var
path: UTF8String;
p: integer;
begin
result:='';
path := ExtractFilePath(ParamStr(0));
p := Pos('Samples', path);
Delete(path, p + 7, Length(path));
path := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(path) + 'media');
SetCurrentDir(path);
MediaPath:=Path;
result:=path;
end;
Tested on Lazarus 2.0.4 GTK2 Linux-64. I'm not sure what is the version of GLScene. I've just installed it using OPM, it maybe the latest version.
Below is the screenshot, after the bug fix: