GlColorMask: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glColorMask, glColorMaski:''' enable and disable writing of frame buffer color components {{PageSyntax}} :: SUB _glColorMask (BYVAL red AS _UNSIGNED _BYTE, BYVAL green AS _UNSIGNED _BYTE, BYVAL blue AS _UNSIGNED _BYTE, BYVAL alpha AS _UNSIGNED _BYTE) :: void '''_glColorMask'''(GLboolean {{Parameter|red}}, GLboolean {{Parameter|green}}, GLboolean {{Parameter|blue}}, GLboolean {{Parameter|alpha}}); :: void '''_glColorMaski'''(GLuint {{Parameter|buf}}, GLboolean {...")
 
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glColorMask, glColorMaski:''' enable and disable writing of frame buffer color components
{{DISPLAYTITLE:_glColorMask}}
 
The '''_glColorMask''' statement enables and disables writing of frame-buffer color components.




{{PageSyntax}}
{{PageSyntax}}
: [[_glColorMask]] GLboolean {{Parameter|red}}, GLboolean {{Parameter|green}}, GLboolean {{Parameter|blue}}, GLboolean {{Parameter|alpha}}


::  SUB _glColorMask (BYVAL red AS _UNSIGNED _BYTE, BYVAL green AS _UNSIGNED _BYTE, BYVAL blue AS _UNSIGNED _BYTE, BYVAL alpha AS _UNSIGNED _BYTE)
::  void '''_glColorMask'''(GLboolean {{Parameter|red}}, GLboolean {{Parameter|green}}, GLboolean {{Parameter|blue}}, GLboolean {{Parameter|alpha}});
:: void '''_glColorMaski'''(GLuint {{Parameter|buf}}, GLboolean {{Parameter|red}}, GLboolean {{Parameter|green}}, GLboolean {{Parameter|blue}}, GLboolean {{Parameter|alpha}});


; buf
{{PageParameters}}
: For '''_glColorMaski''', specifies the index of the draw buffer whose color mask to set.
* OpenGL is using its own set of variable types to describe its command parameters.
; red, green, blue, alpha
* Use the following table to find the respective QB64 [[Variable Types]].
: Specify whether red, green, blue, and alpha are to be written into the frame buffer. The initial values are all {{KW|_GL_TRUE}}, indicating that the color components are written.
{{OpenGLTypesPlugin}}




{{PageDescription}}
{{PageDescription}}
 
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
'''_glColorMask''' and '''_glColorMaski''' specify whether the individual color components in the frame buffer can or cannot be written. '''_glColorMaski''' sets the mask for a specific draw buffer, whereas '''_glColorMask''' sets the mask for all draw buffers. If {{Parameter|red}} is {{KW|_GL_FALSE}}, for example, no change is made to the red component of any pixel in any of the color buffers, regardless of the drawing operation attempted.
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glcolormask Microsoft Docs] and is also valid for QB64 usage.
 
Changes to individual bits of components cannot be controlled. Rather, changes are either enabled or disabled for entire color components.
 
 
{{PageErrors}}
 
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|buf}} is greater than {{KW|_GL_MAX_DRAW_BUFFERS}} minus 1.
 
 
{{PageUseWith}}
 
{{KW|_glGet}} with argument {{KW|_GL_COLOR_WRITEMASK}}




{{PageSeeAlso}}
{{PageSeeAlso}}
 
* [[_GL|SUB _GL]]
[[_GL|SUB _GL]]
* [[_glBegin]], [https://learn.microsoft.com/en-us/windows/win32/opengl/glcolor-functions _glColor], [[_glDepthMask]], [[_glEnd]]
{{KW|_glClear}}, {{KW|_glClearBuffer}}, {{KW|_glDepthMask}}, {{KW|_glStencilMask}}
* [https://learn.microsoft.com/en-us/windows/win32/opengl/glgetbooleanv--glgetdoublev--glgetfloatv--glgetintegerv _glGet], [https://learn.microsoft.com/en-us/windows/win32/opengl/glindex-functions _glIndex], [[_glIndexMask]], [[_glStencilMask]]




{{PageCopyright}}
{{PageNavigation}}

Latest revision as of 00:46, 28 January 2023

The _glColorMask statement enables and disables writing of frame-buffer color components.


Syntax

_glColorMask GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha


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