Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
- void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const *pixels)
Maps part of the specified texture image to each primitive that is textured into activity. The texture is active when the current fragment shader or vertex shader uses the built-in texture lookup function. Call glTexImage2D to define a texture image. Before that, call glBindTexture to specify the texture ID to be operated. This API allows you to redefine the texture object.
Parameter |
Type |
Description |
|---|---|---|
target |
unsigned integer |
Target texture. Must be GL_TEXTURE_2D. |
level |
integer |
Execution detail level. 0 indicates the basic image level, and n indicates level n. |
internalformat |
integer |
Color component of the texture. The options are as follows:
|
width |
integer |
Width of the texture image. Must be a power of 2 (2n). The texture image must support the width of at least 64 material elements. |
height |
integer |
Height of the texture image. Must be a power of 2 (2m). The texture image must support the height of at least 64 material elements. |
border |
integer |
Width of the border. Must be set to 0. |
format |
unsigned integer |
Color format of the pixel data. Its value does not need to be the same as internalformat. For details about the options, please refer to internalformat. |
type |
unsigned integer |
Data type of the specified pixel data. The options are as follows:
|
pixels |
pointer |
Pointer to image data in the specified memory. |
- glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, fbo_width, fbo_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);