GlReadBuffer: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
m (Protected "GlReadBuffer" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glReadBuffer:''' select a color buffer source for pixel read operations from the current read framebuffer.
{{DISPLAYTITLE:_glReadBuffer}}
The '''_glReadBuffer''' statement selects a color buffer source for pixels.




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


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


 
{{PageParameters}}
; mode
* OpenGL is using its own set of variable types to describe its command parameters.
: Specifies a color buffer. Accepted values are {{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 the constants {{KW|_GL_COLOR_ATTACHMENT''i''}}.
* 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.
'''_glReadBuffer''' specifies which color buffer within the current bound {{KW|_GL_READ_FRAMEBUFFER}} will be used as the source for pixel reading commands. These commands include: {{KW|_glBlitFramebuffer}}, {{KW|_glReadPixels}}, {{KW|_glCopyTexImage1D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage2D}}, and {{KW|_glCopyTexSubImage3D}}.
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glreadbuffer Microsoft Docs] and is also valid for QB64 usage.
 
{{Parameter|mode}} accepts one of twelve or more predefined values. If the [[default framebuffer]] (the zero [[framebuffer object]])is bound to {{KW|_GL_READ_FRAMEBUFFER}}, then the following enumerators can be used: {{KW|_GL_FRONT}}, {{KW|_GL_LEFT}}, and {{KW|_GL_FRONT_LEFT}} all name the front left buffer, {{KW|_GL_FRONT_RIGHT}} and {{KW|_GL_RIGHT}} name the front right buffer, and {{KW|_GL_BACK_LEFT}} and {{KW|_GL_BACK}} name the back left buffer. Nonstereo double-buffered configurations have only a front left and a back left buffer. Single-buffered configurations have a front left and a front right buffer if stereo, and only a front left buffer if nonstereo.
 
If a non-zero framebuffer object is bound, then the constants {{KW|_GL_COLOR_ATTACHMENT''i''}} may be used to indicate the ''i''<sup>th</sup> color attachment, where ''i'' ranges from zero to the value of {{KW|_GL_MAX_COLOR_ATTACHMENTS}} minus one.
 
It is an error to specify a nonexistent buffer to '''_glReadBuffer'''.
 
For the default framebuffer, {{Parameter|mode}} is initially {{KW|_GL_FRONT}} in single-buffered configurations and {{KW|_GL_BACK}} in double-buffered configurations. For framebuffer objects, the default read buffer is {{KW|_GL_COLOR_ATTACHMENT0}}.
 
 
{{PageErrors}}
 
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not one of the twelve (or more) accepted values.
 
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|mode}} specifies a buffer that does not exist.
 
 
{{PageUseWith}}
 
{{KW|_glGet}} with argument {{KW|_GL_READ_BUFFER}}




{{PageSeeAlso}}
{{PageSeeAlso}}
* [[_GL|SUB _GL]]
* [[_glBegin]], [[_glCopyPixels]], [[_glDrawBuffer]], [[_glEnd]]
* [[_glReadPixels]]


[[_GL|SUB _GL]]
{{KW|_glBindFramebuffer}}, {{KW|_glDrawBuffer}}, {{KW|_glDrawBuffers}}, {{KW|_glReadPixels}}
{{PageCopyright}}


Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2011 Khronos Group. 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:33, 28 January 2023

The _glReadBuffer statement selects a color buffer source for pixels.


Syntax

_glReadBuffer 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