GlPolygonOffset: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glPolygonOffset:''' set the scale and units used to calculate depth values {{PageSyntax}} SUB _glPolygonOffset (BYVAL factor AS SINGLE, BYVAL units AS SINGLE) void '''_glPolygonOffset'''(GLfloat {{Parameter|factor}}, GLfloat {{Parameter|units}}); ; factor : Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0. ; units : Is multiplied by an implementation-specific value to create a constant depth off...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glPolygonOffset:''' set the scale and units used to calculate depth values
{{DISPLAYTITLE:_glPolygonOffset}}
The '''_glPolygonOffset''' statement sets the scale and units OpenGL uses to calculate depth values.




{{PageSyntax}}
{{PageSyntax}}
: [[_glPolygonOffset]] GLfloat {{Parameter|factor}}, GLfloat {{Parameter|units}}


  SUB _glPolygonOffset (BYVAL factor AS SINGLE, BYVAL units AS SINGLE)
  void '''_glPolygonOffset'''(GLfloat {{Parameter|factor}}, GLfloat {{Parameter|units}});


 
{{PageParameters}}
; factor
* OpenGL is using its own set of variable types to describe its command parameters.
: Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0.
* Use the following table to find the respective QB64 [[Variable Types]].
; units
{{OpenGLTypesPlugin}}
: Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.




{{PageDescription}}
{{PageDescription}}
 
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
When {{KW|_GL_POLYGON_OFFSET_FILL}}, {{KW|_GL_POLYGON_OFFSET_LINE}}, or {{KW|_GL_POLYGON_OFFSET_POINT}} is enabled, each fragment's ''depth'' value will be offset after it is interpolated from the ''depth'' values of the appropriate vertices. The value of the offset is ''factor'' * ''DZ'' + ''r'' * ''units'', where ''DZ'' is a measurement of the change in depth relative to the screen area of the polygon, and ''r'' is the smallest value that is guaranteed to produce a resolvable offset for a given implementation. The offset is added before the depth test is performed and before the value is written into the depth buffer.
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glpolygonoffset Microsoft Docs] and is also valid for QB64 usage.
 
'''_glPolygonOffset''' is useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges.
 
 
{{PageUseWith}}
 
{{KW|_glIsEnabled}} with argument {{KW|_GL_POLYGON_OFFSET_FILL}}, {{KW|_GL_POLYGON_OFFSET_LINE}}, or {{KW|_GL_POLYGON_OFFSET_POINT}}.
 
{{KW|_glGet}} with argument {{KW|_GL_POLYGON_OFFSET_FACTOR}} or {{KW|_GL_POLYGON_OFFSET_UNITS}}.




{{PageSeeAlso}}
{{PageSeeAlso}}
* [[_GL|SUB _GL]]
* [[_glDepthFunc]], [[_glDisable]], [[_glEnable]], [https://learn.microsoft.com/en-us/windows/win32/opengl/glgetbooleanv--glgetdoublev--glgetfloatv--glgetintegerv _glGet]
* [[_glIsEnabled]], [[_glLineWidth]], [[_glStencilOp]], [https://learn.microsoft.com/en-us/windows/win32/opengl/gltexenv-functions _glTexEnv]


[[_GL|SUB _GL]]
{{KW|_glDepthFunc}}, {{KW|_glEnable}}
{{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:24, 28 January 2023

The _glPolygonOffset statement sets the scale and units OpenGL uses to calculate depth values.


Syntax

_glPolygonOffset GLfloat factor, GLfloat units


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