GlCopyTexSubImage2D: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''_glCopyTexSubImage2D:''' copy a two-dimensional texture subimage {{PageSyntax}} : SUB _glCopyTexSubImage2D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL xoffset AS LONG, BYVAL yoffset AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL height AS LONG) : void '''_glCopyTexSubImage2D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|yoffset}}, GLint {{Parameter|x}}, GLint {{Par...")
 
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''_glCopyTexSubImage2D:''' copy a two-dimensional texture subimage
{{DISPLAYTITLE:_glCopyTexSubImage2D}}
The '''_glCopyTexSubImage2D''' statement copies a sub-image of a two-dimensional texture image from the framebuffer.




{{PageSyntax}}
{{PageSyntax}}
: [[_glCopyTexSubImage2D]] GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|yoffset}}, GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}}


:  SUB _glCopyTexSubImage2D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL xoffset AS LONG, BYVAL yoffset AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL height AS LONG)


:  void '''_glCopyTexSubImage2D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|yoffset}}, GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}});
{{PageParameters}}
 
* 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]].
; target
{{OpenGLTypesPlugin}}
: Specifies the target texture. Must be {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}.
; level
: Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
; xoffset
: Specifies a texel offset in the x direction within the texture array.
; yoffset
: Specifies a texel offset in the y direction within the texture array.
; x, y
: Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.
; width
: Specifies the width of the texture subimage.
; height
: Specifies the height of the texture subimage.




{{PageDescription}}
{{PageDescription}}
 
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
'''_glCopyTexSubImage2D''' replaces a rectangular portion of a two-dimensional texture image, cube-map texture image or a linear portion of a number of slices of a one-dimensional array texture with pixels from the current {{KW|_GL_READ_BUFFER}} (rather than from main memory, as is the case for {{KW|_glTexSubImage2D}}).
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glcopytexsubimage2d Microsoft Docs] and is also valid for QB64 usage.
 
The screen-aligned pixel rectangle with lower left corner at (''x'', ''y'') and with width {{Parameter|width}} and height {{Parameter|height}} replaces the portion of the texture array with x indices {{Parameter|xoffset}} through ''xoffset + width - 1'', inclusive, and y indices {{Parameter|yoffset}} through ''yoffset + height - 1'', inclusive, at the mipmap level specified by {{Parameter|level}}.
 
The pixels in the rectangle are processed exactly as if {{KW|_glReadPixels}} had been called, but the process stops just before final conversion. At this point, all pixel component values are clamped to the range [0, 1] and then converted to the texture's internal format for storage in the texel array.
 
The destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.
 
When {{Parameter|target}} is {{KW|_GL_TEXTURE_1D_ARRAY}} then the y coordinate and height are treated as the start slice and number of slices to modify.
 
If any of the pixels within the specified rectangle of the current {{KW|_GL_READ_BUFFER}} are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.
 
No change is made to the ''internalformat'', ''width'', ''height'', or ''border'' parameters of the specified texture array or to texel values outside the specified subregion.
 
 
{{PageNotes}}
 
{{KW|_glPixelStore}} modes affect texture images.
 
 
{{PageErrors}}
 
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}} is not {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}.
 
{{KW|_GL_INVALID_OPERATION}} is generated if the texture array has not been defined by a previous {{KW|_glTexImage2D}} or {{KW|_glCopyTexImage2D}} operation.
 
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
 
{{KW|_GL_INVALID_VALUE}} may be generated if ''level'' is greater than log<sub>2</sub>(max), where ''max'' is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
 
{{KW|_GL_INVALID_VALUE}} is generated if xoffset < 0, xoffset + width > w, yoffset < 0, or yoffset + height > h, where w is the {{KW|_GL_TEXTURE_WIDTH}} and h is the {{KW|_GL_TEXTURE_HEIGHT}} of the texture image being modified.
 
 
{{PageUseWith}}
 
{{KW|_glGetTexImage}}




{{PageSeeAlso}}
{{PageSeeAlso}}
 
* [[_GL|SUB _GL]]
[[_GL|SUB _GL]]
* [[_glBegin]], [[_glCopyPixels]], [[_glCopyTexSubImage1D]], [[_glDrawPixels]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glBindFramebuffer}}, {{KW|_glCopyImageSubData}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage3D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glReadBuffer}}
* [[_glEnd]], [https://learn.microsoft.com/en-us/windows/win32/opengl/glfog _glFog], [https://learn.microsoft.com/en-us/windows/win32/opengl/glpixelstore-functions _glPixelStore], [https://learn.microsoft.com/en-us/windows/win32/opengl/glpixeltransfer _glPixelTransfer]
* [https://learn.microsoft.com/en-us/windows/win32/opengl/gltexenv-functions _glTexEnv], [https://learn.microsoft.com/en-us/windows/win32/opengl/gltexgen-functions _glTexGen], [[_glTexImage2D]], [[_glTexSubImage2D]]
* [https://learn.microsoft.com/en-us/windows/win32/opengl/gltexparameter-functions _glTexParameter]




{{PageCopyright}}
{{PageNavigation}}

Latest revision as of 00:47, 28 January 2023

The _glCopyTexSubImage2D statement copies a sub-image of a two-dimensional texture image from the framebuffer.


Syntax

_glCopyTexSubImage2D GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height


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