PDA

View Full Version : OpenGL info



Thyandyr
18-10-2017, 09:35 PM
Is there an easy way, or does anyone have code for retrieving all the OpenGL info to a StringList, Inifile etc. ?

Like php_info() in php

Thyandyr
18-10-2017, 10:18 PM
Template to expand:



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

Chebmaster
19-10-2017, 08:19 PM
Is there an easy way
There is none as far as I know.
OpenGL wasn't created. It evolved. Nuff said.

SilverWarior
19-10-2017, 10:42 PM
Is there an easy way, or does anyone have code for retrieving all the OpenGL info to a StringList, Inifile etc. ?

I don't know how easy it is but it is definitely possible. Just check the glCapsViewer that is developed by PGD Member Sascha Willems
https://www.saschawillems.de/?page_id=771

As you can see on the web page this tools was first developed in Delphi but Sascha decided to move to using of C++ instead.

Any way I think he could provide you with best information on how to retrieve this information. Now since lately he isn't visiting PGD so frequently I recommend you get in contact with him though his web page instead.

Also if you haven't already I strongly recommend you check his awesome game Projekt "W"
https://www.saschawillems.de/?page_id=829

Thyandyr
20-10-2017, 08:03 PM
I don't know how easy it is but it is definitely possible. Just check the glCapsViewer that is developed by PGD Member Sascha Willems
https://www.saschawillems.de/?page_id=771

As you can see on the web page this tools was first developed in Delphi but Sascha decided to move to using of C++ instead.

Any way I think he could provide you with best information on how to retrieve this information. Now since lately he isn't visiting PGD so frequently I recommend you get in contact with him though his web page instead.

Also if you haven't already I strongly recommend you check his awesome game Projekt "W"
https://www.saschawillems.de/?page_id=829

What a productive guy! That W project part 1 says it was done with Pascal, I guess part 2 was just an extension to it.

Anyway I guess I'll just add parameters to my own script at the rate I end up wanting to know what the limit is.

SilverWarior
21-10-2017, 02:56 PM
That W project part 1 says it was done with Pascal, I guess part 2 was just an extension to it.

Yes Projekt W was created in pascal. But Projekt Weltherrscher - "Phase 2" is much more than just extension of Projekt W. In the beginning it was planed to be just and extension but in ended up being a new game instead. And for short time the game was even more popular than Minecraft at the time. And that it no small feat.

Any way you can read a bit more about it here on the forum:

Projekt W
http://www.pascalgamedevelopment.com/showthread.php?3594-Projekt-quot-W-quot&highlight=project

Projekt Weltherrscher - "Phase 2"
http://www.pascalgamedevelopment.com/showthread.php?13968-Projekt-Weltherrscher-quot-Phase-2-quot

Akira13
23-10-2017, 01:07 AM
There is none as far as I know.
OpenGL wasn't created. It evolved. Nuff said.

lol what is this even supposed to mean? Makes zero sense. Of course there's a way to do it (many ways, actually), and none of them are very difficult to implement at all. The dglOpenGL unit actually includes a function that literally just returns all supported extensions in a single string, called "Int_GetExtensionString". For whatever reason though it doesn't have a "forward", pre-implementation-section declaration so it isn't externally visible by default. However, all anyone needs to do to use it is simply copy and paste


function Int_GetExtensionString: AnsiString;

anywhere in the file before ​"implementation" and below the type declarations.

Thyandyr
23-10-2017, 09:26 AM
lol what is this even supposed to mean? Makes zero sense. Of course there's a way to do it (many ways, actually), and none of them are very difficult to implement at all. The dglOpenGL unit actually includes a function that literally just returns all supported extensions in a single string, called "Int_GetExtensionString". For whatever reason though it doesn't have a "forward", pre-implementation-section declaration so it isn't externally visible by default. However, all anyone needs to do to use it is simply copy and paste


function Int_GetExtensionString: AnsiString;

anywhere in the file before ​"implementation" and below the type declarations.

I accidentally scrolled all the way down in dglOpenGL, and saw some of those functions at the end, and wondered how does that work with no var parameter or no return value :P

Akira13
23-10-2017, 06:51 PM
I accidentally scrolled all the way down in dglOpenGL, and saw some of those functions at the end, and wondered how does that work with no var parameter or no return value :P

Not quite sure what you mean here?

Thyandyr
23-10-2017, 08:04 PM
Not quite sure what you mean here?

I meant that I saw code in dglOpengl that looked like it might be something like returning all the extensions but I didn't see anything for parameters. Didn't pay much attention to it at the time, and I was not eager to scroll up and down in 20000 line unit.