Results 1 to 10 of 10

Thread: OpenGL info

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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.

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

  3. #3
    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.

  4. #4
    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

  5. #5
    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?

  6. #6
    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
  •