Template to expand:
Code:
uses
dglOpenGL, // https://github.com/SaschaWillems/dglOpenGL
Inifiles;
procedure glInfoToDisk;
var
Ini: TCustomIniFile;
Path: String;
StatusI: GLint;
begin
// Check if openGL initialized
if not assigned(glGetIntegerv) then
begin
raise Exception.Create('glInfoToDisk: openGL not initialized');
exit;
end;
// Make folder
{$IOChecks off}
MkDir('Debug');
{$IOChecks on}
// Set path
Path:= ExtractFilePath(Application.ExeName)+'\Debug';
// Check path exists
if not DirectoryExists(Path) then begin
raise Exception.Create('glInfoToDisk: cannot create folder');
exit;
end;
// Create file
Ini := TInifile.Create(Path+'\OpenGLinfo.ini');
try
// Total textures available
StatusI := -1;
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, @StatusI);
Ini.WriteInteger('OpenGLInfo', 'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS', StatusI);
// Texutres available per shader
StatusI := -1;
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, @StatusI);
Ini.WriteInteger('OpenGLInfo', 'GL_MAX_TEXTURE_IMAGE_UNITS', StatusI);
// openGL version
Ini.WriteString('OpenGLInfo', 'GL_VERSION', glGetString(GL_VERSION));
finally
Ini.Free;
end;
end;
[OpenGLInfo]
GL_MAX_TEXTURE_IMAGE_UNITS=32
GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=192
Bookmarks