GlDrawBuffer: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glDrawBuffer:''' specify which color buffers are to be drawn into {{PageSyntax}} :: SUB _glDrawBuffer (BYVAL mode AS _UNSIGNED LONG) :: void '''_glDrawBuffer'''(GLenum {{Parameter|mode}}); ; mode : Specifies up to four color buffers to be drawn into. Symbolic constants {{KW|_GL_NONE}}, {{KW|_GL_FRONT_LEFT}}, {{KW|_GL_FRONT_RIGHT}}, {{KW|_GL_BACK_LEFT}}, {{KW|_GL_BACK_RIGHT}}, {{KW|_GL_FRONT}}, {{KW|_GL_BACK}}, {{KW|_GL_LEFT}}, {{KW|_GL_RIGHT}}, and {{KW|_GL_FR...")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glDrawBuffer:''' specify which color buffers are to be drawn into
{{DISPLAYTITLE:_glDrawBuffer}}
The '''_glDrawBuffer''' statement specifies which color buffers are to be drawn into.




{{PageSyntax}}
{{PageSyntax}}
: [[_glDrawBuffer]] GLenum {{Parameter|mode}}


::  SUB _glDrawBuffer (BYVAL mode AS _UNSIGNED LONG)
::  void '''_glDrawBuffer'''(GLenum {{Parameter|mode}});


 
{{PageParameters}}
; mode
* OpenGL is using its own set of variable types to describe its command parameters.
: Specifies up to four color buffers to be drawn into. Symbolic constants {{KW|_GL_NONE}}, {{KW|_GL_FRONT_LEFT}}, {{KW|_GL_FRONT_RIGHT}}, {{KW|_GL_BACK_LEFT}}, {{KW|_GL_BACK_RIGHT}}, {{KW|_GL_FRONT}}, {{KW|_GL_BACK}}, {{KW|_GL_LEFT}}, {{KW|_GL_RIGHT}}, and {{KW|_GL_FRONT_AND_BACK}} are accepted. The initial value is {{KW|_GL_FRONT}} for single-buffered contexts, and {{KW|_GL_BACK}} for double-buffered contexts.
* 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.
When colors are written to the frame buffer, they are written into the color buffers specified by '''_glDrawBuffer'''. The specifications are as follows:
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/gldrawbuffer Microsoft Docs] and is also valid for QB64 usage.
 
; {{KW|_GL_NONE}}
: No color buffers are written.
; {{KW|_GL_FRONT_LEFT}}
: Only the front left color buffer is written.
; {{KW|_GL_FRONT_RIGHT}}
: Only the front right color buffer is written.
; {{KW|_GL_BACK_LEFT}}
: Only the back left color buffer is written.
; {{KW|_GL_BACK_RIGHT}}
: Only the back right color buffer is written.
; {{KW|_GL_FRONT}}
: Only the front left and front right color buffers are written. If there is no front right color buffer, only the front left color buffer is written.
; {{KW|_GL_BACK}}
: Only the back left and back right color buffers are written. If there is no back right color buffer, only the back left color buffer is written.
; {{KW|_GL_LEFT}}
: Only the front left and back left color buffers are written. If there is no back left color buffer, only the front left color buffer is written.
; {{KW|_GL_RIGHT}}
: Only the front right and back right color buffers are written. If there is no back right color buffer, only the front right color buffer is written.
; {{KW|_GL_FRONT_AND_BACK}}
: All the front and back color buffers (front left, front right, back left, back right) are written. If there are no back color buffers, only the front left and front right color buffers are written. If there are no right color buffers, only the front left and back left color buffers are written. If there are no right or back color buffers, only the front left color buffer is written.
If more than one color buffer is selected for drawing, then blending or logical operations are computed and applied independently for each color buffer and can produce different results in each buffer.
 
Monoscopic contexts include only ''left'' buffers, and stereoscopic contexts include both ''left'' and ''right'' buffers. Likewise, single-buffered contexts include only ''front'' buffers, and double-buffered contexts include both ''front'' and ''back'' buffers. The context is selected at GL initialization.
 
 
{{PageErrors}}
 
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not an accepted value.
 
{{KW|_GL_INVALID_OPERATION}} is generated if none of the buffers indicated by {{Parameter|mode}} exists.
 
 
{{PageUseWith}}
 
{{KW|_glGet}} with argument {{KW|_GL_DRAW_BUFFER}}




{{PageSeeAlso}}
{{PageSeeAlso}}
 
* [[_GL|SUB _GL]]
[[_GL|SUB _GL]]
* [[_glBegin]], [[_glBlendFunc]], [[_glColorMask]], [[_glEnd]]
{{KW|_glBindFramebuffer}}, {{KW|_glBlendFunc}}, {{KW|_glColorMask}}, {{KW|_glDrawBuffers}}, {{KW|_glLogicOp}}
* [https://learn.microsoft.com/en-us/windows/win32/opengl/glgetbooleanv--glgetdoublev--glgetfloatv--glgetintegerv _glGet], [[_glIndexMask]], [[_glLogicOp]], [[_glReadBuffer]]




{{PageCopyright}}
{{PageNavigation}}

Latest revision as of 00:50, 28 January 2023

The _glDrawBuffer statement specifies which color buffers are to be drawn into.


Syntax

_glDrawBuffer 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