Results 1 to 10 of 10

Thread: OpenGL info

  1. #1

    OpenGL info

    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

  2. #2
    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
    Last edited by Thyandyr; 19-10-2017 at 09:03 AM.

  3. #3
    Is there an easy way
    There is none as far as I know.
    OpenGL wasn't created. It evolved. Nuff said.

  4. #4
    Quote Originally Posted by Thyandyr View Post
    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

  5. #5
    Quote Originally Posted by SilverWarior View Post
    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.

  6. #6
    Quote Originally Posted by Thyandyr View Post
    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...t-Phase-2-quot

  7. #7
    Quote Originally Posted by Chebmaster View Post
    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

    Code:
    function Int_GetExtensionString: AnsiString;
    anywhere in the file before ​"implementation" and below the type declarations.
    Last edited by Akira13; 23-10-2017 at 03:23 AM.

  8. #8
    Quote Originally Posted by Akira13 View Post
    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

    Code:
    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

  9. #9
    Quote Originally Posted by Thyandyr View Post
    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
    Not quite sure what you mean here?

  10. #10
    Quote Originally Posted by Akira13 View Post
    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.
    Last edited by Thyandyr; 23-10-2017 at 08:06 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •