GlHint: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glHint:''' specify implementation-specific hints {{PageSyntax}} SUB _glHint (BYVAL target AS _UNSIGNED LONG, BYVAL mode AS _UNSIGNED LONG) void '''_glHint'''(GLenum {{Parameter|target}}, GLenum {{Parameter|mode}}); ; target : Specifies a symbolic constant indicating the behavior to be controlled. {{KW|_GL_LINE_SMOOTH_HINT}}, {{KW|_GL_POLYGON_SMOOTH_HINT}}, {{KW|_GL_TEXTURE_COMPRESSION_HINT}}, and {{KW|_GL_FRAGMENT_SHADER_DERIVATIVE_HINT}} are accepted. ; mod...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glHint:''' specify implementation-specific hints
{{DISPLAYTITLE:_glHint}}
The '''_glHint''' statement specifies implementation-specific hints.




{{PageSyntax}}
{{PageSyntax}}
: [[_glHint]] GLenum {{Parameter|target}}, GLenum {{Parameter|mode}}


  SUB _glHint (BYVAL target AS _UNSIGNED LONG, BYVAL mode AS _UNSIGNED LONG)
  void '''_glHint'''(GLenum {{Parameter|target}}, GLenum {{Parameter|mode}});


 
{{PageParameters}}
; target
* OpenGL is using its own set of variable types to describe its command parameters.
: Specifies a symbolic constant indicating the behavior to be controlled. {{KW|_GL_LINE_SMOOTH_HINT}}, {{KW|_GL_POLYGON_SMOOTH_HINT}}, {{KW|_GL_TEXTURE_COMPRESSION_HINT}}, and {{KW|_GL_FRAGMENT_SHADER_DERIVATIVE_HINT}} are accepted.
* Use the following table to find the respective QB64 [[Variable Types]].
; mode
{{OpenGLTypesPlugin}}
: Specifies a symbolic constant indicating the desired behavior. {{KW|_GL_FASTEST}}, {{KW|_GL_NICEST}}, and {{KW|_GL_DONT_CARE}} are accepted.




{{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/glhint Microsoft Docs] and is also valid for QB64 usage.


Certain aspects of GL behavior, when there is room for interpretation, can be controlled with hints. A hint is specified with two arguments. {{Parameter|target}} is a symbolic constant indicating the behavior to be controlled, and {{Parameter|mode}} is another symbolic constant indicating the desired behavior. The initial value for each {{Parameter|target}} is {{KW|_GL_DONT_CARE}}. {{Parameter|mode}} can be one of the following:
; {{KW|_GL_FASTEST}}
:
The most efficient option should be chosen.
; {{KW|_GL_NICEST}}
:
The most correct, or highest quality, option should be chosen.
; {{KW|_GL_DONT_CARE}}
:
No preference.
Though the implementation aspects that can be hinted are well defined, the interpretation of the hints depends on the implementation. The hint aspects that can be specified with {{Parameter|target}}, along with suggested semantics, are as follows:
; {{KW|_GL_FRAGMENT_SHADER_DERIVATIVE_HINT}}
:
Indicates the accuracy of the derivative calculation for the GL shading language fragment processing built-in functions: {{KW|_dFdx}}, {{KW|_dFdy}}, and {{KW|_fwidth}}.
; {{KW|_GL_LINE_SMOOTH_HINT}}
:
Indicates the sampling quality of antialiased lines. If a larger filter function is applied, hinting {{KW|_GL_NICEST}} can result in more pixel fragments being generated during rasterization.
; {{KW|_GL_POLYGON_SMOOTH_HINT}}
:
Indicates the sampling quality of antialiased polygons. Hinting {{KW|_GL_NICEST}} can result in more pixel fragments being generated during rasterization, if a larger filter function is applied.
; {{KW|_GL_TEXTURE_COMPRESSION_HINT}}
:
Indicates the quality and performance of the compressing texture images. Hinting {{KW|_GL_FASTEST}} indicates that texture images should be compressed as quickly as possible, while {{KW|_GL_NICEST}} indicates that texture images should be compressed with as little image quality loss as possible. {{KW|_GL_NICEST}} should be selected if the texture is to be retrieved by {{KW|_glGetCompressedTexImage}} for reuse.
{{PageNotes}}
The interpretation of hints depends on the implementation. Some implementations ignore '''_glHint''' settings.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if either {{Parameter|target}} or {{Parameter|mode}} is not an accepted value.


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


{{PageCopyright}}


Copyright 1991-2006 Silicon Graphics, Inc. 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:05, 28 January 2023

The _glHint statement specifies implementation-specific hints.


Syntax

_glHint GLenum target, GLenum mode


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