GlPolygonMode: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glPolygonMode:''' select a polygon rasterization mode
{{DISPLAYTITLE:_glPolygonMode}}
The '''_glPolygonMode''' statement selects a polygon rasterization mode.




{{PageSyntax}}
{{PageSyntax}}
: [[_glPolygonMode]] GLenum {{Parameter|face}}, GLenum {{Parameter|mode}}


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


 
{{PageParameters}}
; face
* OpenGL is using its own set of variable types to describe its command parameters.
: Specifies the polygons that {{Parameter|mode}} applies to. Must be {{KW|_GL_FRONT_AND_BACK}} for front- and back-facing polygons.
* Use the following table to find the respective QB64 [[Variable Types]].
; mode
{{OpenGLTypesPlugin}}
: Specifies how polygons will be rasterized. Accepted values are {{KW|_GL_POINT}}, {{KW|_GL_LINE}}, and {{KW|_GL_FILL}}. The initial value is {{KW|_GL_FILL}} for both front- and back-facing polygons.




{{PageDescription}}
{{PageDescription}}
 
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
'''_glPolygonMode''' controls the interpretation of polygons for rasterization. {{Parameter|face}} describes which polygons {{Parameter|mode}} applies to: both front and back-facing polygons ({{KW|_GL_FRONT_AND_BACK}}). The polygon mode affects only the final rasterization of polygons. In particular, a polygon's vertices are lit and the polygon is clipped and possibly culled before these modes are applied.
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glpolygonmode Microsoft Docs] and is also valid for QB64 usage.
 
Three modes are defined and can be specified in {{Parameter|mode}}:
 
; {{KW|_GL_POINT}}
: Polygon vertices that are marked as the start of a boundary edge are drawn as points. Point attributes such as {{KW|_GL_POINT_SIZE}} and {{KW|_GL_POINT_SMOOTH}} control the rasterization of the points. Polygon rasterization attributes other than {{KW|_GL_POLYGON_MODE}} have no effect.
; {{KW|_GL_LINE}}
: Boundary edges of the polygon are drawn as line segments. Line attributes such as {{KW|_GL_LINE_WIDTH}} and {{KW|_GL_LINE_SMOOTH}} control the rasterization of the lines. Polygon rasterization attributes other than {{KW|_GL_POLYGON_MODE}} have no effect.
; {{KW|_GL_FILL}}
: The interior of the polygon is filled. Polygon attributes such as {{KW|_GL_POLYGON_SMOOTH}} control the rasterization of the polygon.
== Examples ==
 
To draw a surface with outlined polygons, call {{InlineCode}}glPolygonMode(, ){{InlineCodeEnd}}
 
 
{{PageNotes}}
 
Vertices are marked as boundary or nonboundary with an edge flag. Edge flags are generated internally by the GL when it decomposes triangle stips and fans.
 
 
{{PageErrors}}
 
{{KW|_GL_INVALID_ENUM}} is generated if either {{Parameter|face}} or {{Parameter|mode}} is not an accepted value.
 
 
{{PageUseWith}}
 
{{KW|_glGet}} with argument {{KW|_GL_POLYGON_MODE}}




{{PageSeeAlso}}
{{PageSeeAlso}}
* [[_GL|SUB _GL]]
* [[_glBegin]], [https://learn.microsoft.com/en-us/windows/win32/opengl/gledgeflag-functions _glEdgeFlag], [[_glEnd]], [[_glLineStipple]]
* [[_glLineWidth]], [[_glPointSize]], [[_glPolygonStipple]]


[[_GL|SUB _GL]]
{{KW|_glLineWidth}}, {{KW|_glPointSize}}
{{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:23, 28 January 2023

The _glPolygonMode statement selects a polygon rasterization mode.


Syntax

_glPolygonMode GLenum face, 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