GlGetString: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glGetString:''' return a string describing the current GL connection {{PageSyntax}} FUNCTION _glGetString&& (BYVAL name AS _UNSIGNED LONG) const GLubyte* '''_glGetString'''(GLenum {{Parameter|name}}); const GLubyte* '''_glGetStringi'''(GLenum {{Parameter|name}}, GLuint {{Parameter|index}}); ; name : Specifies a symbolic constant, one of {{KW|_GL_VENDOR}}, {{KW|_GL_RENDERER}}, {{KW|_GL_VERSION}}, or {{KW|_GL_SHADING_LANGUAGE_VERSION}}. Additionally, '''_glG...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glGetString:''' return a string describing the current GL connection
{{DISPLAYTITLE:_glGetString}}
The '''_glGetString''' function returns a string describing the current OpenGL connection.




{{PageSyntax}}
{{PageSyntax}}
: const GLubyte {{Parameter|*result}} = [[_glGetString]] (GLenum {{Parameter|name}})


  FUNCTION _glGetString&& (BYVAL name AS _UNSIGNED LONG)
  const GLubyte* '''_glGetString'''(GLenum {{Parameter|name}});


  const GLubyte* '''_glGetStringi'''(GLenum {{Parameter|name}}, GLuint {{Parameter|index}});
{{PageParameters}}
 
* OpenGL is using its own set of variable types to describe its command parameters.
; name
* Use the following table to find the respective QB64 [[Variable Types]].
: Specifies a symbolic constant, one of {{KW|_GL_VENDOR}}, {{KW|_GL_RENDERER}}, {{KW|_GL_VERSION}}, or {{KW|_GL_SHADING_LANGUAGE_VERSION}}. Additionally, '''_glGetStringi''' accepts the {{KW|_GL_EXTENSIONS}} token.
{{OpenGLTypesPlugin}}
; index
: For '''_glGetStringi''', specifies the index of the string to return.




{{PageDescription}}
{{PageDescription}}
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glgetstring Microsoft Docs] and is also valid for QB64 usage.


'''_glGetString''' returns a pointer to a static string describing some aspect of the current GL connection. {{Parameter|name}} can be one of the following:
; {{KW|_GL_VENDOR}}
:
Returns the company responsible for this GL implementation. This name does not change from release to release.
; {{KW|_GL_RENDERER}}
:
Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release.
; {{KW|_GL_VERSION}}
:
Returns a version or release number.
; {{KW|_GL_SHADING_LANGUAGE_VERSION}}
:
Returns a version or release number for the shading language.
Strings {{KW|_GL_VENDOR}} and {{KW|_GL_RENDERER}} together uniquely specify a platform. They do not change from release to release and should be used by platform-recognition algorithms.
'''_glGetStringi''' returns a pointer to a static string indexed by {{Parameter|index}}. {{Parameter|name}} can be one of the following:
; {{KW|_GL_EXTENSIONS}}
: For '''_glGetStringi''' only, returns the extension string supported by the implementation at {{Parameter|index}}. The index {{Parameter|index}} is on the range [0 to {{KW|_glGet|Integerv(GL_NUM_EXTENSIONS)}} - 1].
; {{KW|_GL_SHADING_LANGUAGE_VERSION}}
: Returns one of the versions of [[GLSL]] supported by this implementation. {{Parameter|index}} is on the range [0 to {{KW|_glGet|Integerv(GL_NUM_SHADING_LANGUAGE_VERSIONS)}} - 1].
The {{KW|_GL_VERSION}} and {{KW|_GL_SHADING_LANGUAGE_VERSION}} strings begin with a version number. The version number uses one of these forms:
''major_number.minor_number''
or
''major_number.minor_number.release_number''
Vendor-specific information may follow the version number. Its format depends on the implementation, but a space always separates the version number and the vendor-specific information.
All strings are null-terminated.
{{PageNotes}}
If an error is generated, '''_glGetString''' returns 0.
The client and server may support different versions. '''_glGetString''' always returns a compatible version number. The release number always describes the server.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|name}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated by '''_glGetStringi''' if {{Parameter|index}} is outside the valid range for indexed state {{Parameter|name}}.


{{PageSeeAlso}}
* [[_GL|SUB _GL]]
* [[_glBegin]], [[_glEnd]]


{{PageCopyright}}


Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].
{{PageNavigation}}

Latest revision as of 01:03, 28 January 2023

The _glGetString function returns a string describing the current OpenGL connection.


Syntax

const GLubyte *result = _glGetString (GLenum name)


Parameters

  • OpenGL is using its own set of variable types to describe its command parameters.
  • Use the following table to find the respective QB64 Variable Types.
   Table 2: Relations between the OpenGL variable types vs. C/C++ and QB64.
 ┌──────────────┬────────────────┬──────────────────────────────────────────┐
 │    OpenGLC/C++QB64                                 │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLenum       │ unsigned int   │ _UNSIGNED LONG                           │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLboolean    │ unsigned char  │ _UNSIGNED _BYTE                          │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLbitfield   │ unsigned int   │ _UNSIGNED LONG                           │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLbyte       │ signed char    │ _BYTE                                    │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLshort      │ short          │ INTEGER                                  │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLint        │ int            │ LONG                                     │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLsizei      │ int            │ LONG                                     │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLubyte      │ unsigned char  │ _UNSIGNED _BYTE                          │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLushort     │ unsigned short │ _UNSIGNED INTEGER                        │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLuint       │ unsigned int   │ _UNSIGNED LONG                           │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLfloat      │ float          │ SINGLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLclampf     │ float          │ SINGLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLdouble     │ double         │ DOUBLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLclampd     │ double         │ DOUBLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLvoid   (1) │ void           │ _OFFSET(any fixed lenght string or _BYTE │
 │              │                │         array element)                   │
 └──────────────┴────────────────┴──────────────────────────────────────────┘
 Note: If a parameter has an asterisk (*) in front, then it's a pointer to
       the designated OpenGL variable type, rather than a value of that type.
       Those must be passed using the _OFFSET(...) notation.

 E.g.  GLuint *anyParam is actually the offset of a _UNSIGNED LONG (~&)
       variable or array, which must be passed as _OFFSET(anyVar~&) or
       _OFFSET(anyArr~&()) respectively.

  (1)  This type is regularly only used for pointers (with asterisk (*)) to
       any byte sized memory data, hence _BYTE or fixed length strings.


Description

  • OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
  • The full description for this command can be found at Microsoft Docs and is also valid for QB64 usage.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link