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
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
{{TextStart}}
: 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}}.
  '''OpenGL'''    |     '''C/C++'''        |       '''QB64'''
; level
------------+------------------+----------------------
: Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
GLenum      | unsigned int    | [[_UNSIGNED]] [[LONG]]
; xoffset
GLboolean  | unsigned char  | [[_UNSIGNED]] [[_BYTE]]
: Specifies a texel offset in the x direction within the texture array.
GLbitfield  |  unsigned int    |  [[_UNSIGNED]] [[LONG]]
; yoffset
GLbyte      |  signed char    |  [[_BYTE]]
: Specifies a texel offset in the y direction within the texture array.
GLshort    |  short          |  [[INTEGER]]
; x, y
GLint      | int            | [[LONG]]
: Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.
GLsizei    | int            | [[LONG]]
; width
GLubyte    | unsigned char  | [[_UNSIGNED]] [[_BYTE]]
: Specifies the width of the texture subimage.
GLushort    | unsigned short  | [[_UNSIGNED]] [[INTEGER]]
; height
GLuint      |  unsigned int    |  [[_UNSIGNED]] [[LONG]]
: Specifies the height of the texture subimage.
GLfloat    |  float          |  [[SINGLE]]
GLclampf    |  float          |  [[SINGLE]]
GLdouble    |  double          |  [[DOUBLE]]
GLclampd    |  double          |  [[DOUBLE]]
GLvoid      |  void            |  no parameters used
{{TextEnd}}




{{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://docs.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]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glBindFramebuffer}}, {{KW|_glCopyImageSubData}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage3D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glReadBuffer}}


{{PageNavigation}}


{{PageCopyright}}
[[Category:Final]]

Revision as of 23:27, 13 July 2022

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.
  OpenGL     |     C/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      |  void            |  no parameters used


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