GlLogicOp: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glLogicOp:''' specify a logical pixel operation for rendering {{PageSyntax}} SUB _glLogicOp (BYVAL opcode AS _UNSIGNED LONG) void '''_glLogicOp'''(GLenum {{Parameter|opcode}}); ; opcode : Specifies a symbolic constant that selects a logical operation. The following symbols are accepted: {{KW|_GL_CLEAR}}, {{KW|_GL_SET}}, {{KW|_GL_COPY}}, {{KW|_GL_COPY_INVERTED}}, {{KW|_GL_NOOP}}, {{KW|_GL_INVERT}}, {{KW|_GL_AND}}, {{KW|_GL_NAND}}, {{KW|_GL_OR}}, {{KW|_GL_NOR}...")
 
No edit summary
Line 1: Line 1:
'''_glLogicOp:''' specify a logical pixel operation for rendering
{{DISPLAYTITLE:_glLogicOp}}
The '''_glLogicOp''' statement specifies a logical pixel operation for color index rendering.




{{PageSyntax}}
{{PageSyntax}}
: '''_glLogicOp''' GLenum {{Parameter|opcode}}


  SUB _glLogicOp (BYVAL opcode AS _UNSIGNED LONG)
  void '''_glLogicOp'''(GLenum {{Parameter|opcode}});


 
{{PageParameters}}
; opcode
* OpenGL is using its own set of variable types to describe its command parameters.
: Specifies a symbolic constant that selects a logical operation. The following symbols are accepted: {{KW|_GL_CLEAR}}, {{KW|_GL_SET}}, {{KW|_GL_COPY}}, {{KW|_GL_COPY_INVERTED}}, {{KW|_GL_NOOP}}, {{KW|_GL_INVERT}}, {{KW|_GL_AND}}, {{KW|_GL_NAND}}, {{KW|_GL_OR}}, {{KW|_GL_NOR}}, {{KW|_GL_XOR}}, {{KW|_GL_EQUIV}}, {{KW|_GL_AND_REVERSE}}, {{KW|_GL_AND_INVERTED}}, {{KW|_GL_OR_REVERSE}}, and {{KW|_GL_OR_INVERTED}}. The initial value is {{KW|_GL_COPY}}.
* Use the following table to find the respective QB64 [[Variable Types]].
{{OpenGLTypesPlugin}}




{{PageDescription}}
{{PageDescription}}
 
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
'''_glLogicOp''' specifies a logical operation that, when enabled, is applied between the incoming RGBA color and the RGBA color at the corresponding location in the frame buffer. To enable or disable the logical operation, call {{KW|_glEnable}} and {{KW|_glDisable}} using the symbolic constant {{KW|_GL_COLOR_LOGIC_OP}}. The initial value is disabled.
* The full description for this command can be found at [https://docs.microsoft.com/en-us/windows/win32/opengl/gllogicop Microsoft Docs] and is also valid for QB64 usage.
 
 
 
{|
|+
! '''Opcode'''
! '''Resulting Operation'''
|+
| {{KW|_GL_CLEAR}}
| 0
|+
| {{KW|_GL_SET}}
| 1
|+
| {{KW|_GL_COPY}}
| s
|+
| {{KW|_GL_COPY_INVERTED}}
| ~s
|+
| {{KW|_GL_NOOP}}
| d
|+
| {{KW|_GL_INVERT}}
| ~d
|+
| {{KW|_GL_AND}}
| s & d
|+
| {{KW|_GL_NAND}}
| ~(s & d)
|+
| {{KW|_GL_OR}}
| s | d
|+
| {{KW|_GL_NOR}}
| ~(s | d)
|+
| {{KW|_GL_XOR}}
| s ^ d
|+
| {{KW|_GL_EQUIV}}
| ~(s ^ d)
|+
| {{KW|_GL_AND_REVERSE}}
| s & ~d
|+
| {{KW|_GL_AND_INVERTED}}
| ~s & d
|+
| {{KW|_GL_OR_REVERSE}}
| s | ~d
|+
| {{KW|_GL_OR_INVERTED}}
| ~s | d
|}
 
{{Parameter|opcode}} is a symbolic constant chosen from the list above. In the explanation of the logical operations, ''s'' represents the incoming color and ''d'' represents the color in the frame buffer. Standard C-language operators are used. As these bitwise operators suggest, the logical operation is applied independently to each bit pair of the source and destination colors.
 
 
{{PageNotes}}
 
When more than one RGBA color buffer is enabled for drawing, logical operations are performed separately for each enabled buffer, using for the destination value the contents of that buffer (see {{KW|_glDrawBuffer}}).
 
Logic operations have no effect on floating point draw buffers. However, if {{KW|_GL_COLOR_LOGIC_OP}} is enabled, blending is still disabled in this case.
 
 
{{PageErrors}}
 
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|opcode}} is not an accepted value.
 
 
{{PageUseWith}}
 
{{KW|_glGet}} with argument {{KW|_GL_LOGIC_OP_MODE}}.
 
{{KW|_glIsEnabled}} with argument {{KW|_GL_COLOR_LOGIC_OP}}.




{{PageSeeAlso}}
{{PageSeeAlso}}
 
* [[_GL|SUB _GL]]
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_COLOR_LOGIC_OP)}}, {{KW|_glDrawBuffer}}, {{KW|_glDrawBuffers}}, {{KW|_glStencilOp}}




{{PageCopyright}}
{{PageNavigation}}


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/].
[[Category:Final]]

Revision as of 12:27, 19 July 2022

The _glLogicOp statement specifies a logical pixel operation for color index rendering.


Syntax

_glLogicOp GLenum opcode


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