OpenGL notes Seven: Texture common API (b)

FIG directly read the pixel - of colors in the content cache region from

/*
参数1:x,矩形左下⻆角的窗⼝坐标 
参数2:y,矩形左下⻆角的窗⼝坐标 
参数3:width,矩形的宽,以像素为单位 
参数4:height,矩形的⾼,以像素为单位 
参数5:format(OpenGL 像素格式-图)
参数6:type,参数pixels指向的数据 OpenGL 使⽤缓存区中的什么数据类型来存储颜⾊分量(像素数据类型-图)
参数7:pixels,指向图形数据的指针 
*/
void glReadPixels(GLint x,GLint y,GLSizei width,GLSizei height, GLenum format, GLenum type,const void * pixels)
glReadBuffer(mode) //指定读取的缓存 
glWriteBuffer(mode) //指定写⼊的缓存
2421768-17e633e508853858.png
OpenGL pixel format .png

2421768-753d1bb50e6453bd.png
.Png pixel data types

Texture update

void glTexSubImage1D(GLenum target,GLint level,GLint xOffset,GLsizei width,GLenum format,GLenum type,const GLvoid *data)

void glTexSubImage2D(GLenum target,GLint level,GLint xOffset,GLint yOffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid *data)

void glTexSubImage3D(GLenum target,GLint level,GLint xOffset,GLint yOffset,GLint zOffset,GLsizei width,GLsizei height,GLsizei depth,Glenum type,const GLvoid * data)

Insert the replacement textures

void glCopyTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)

void glCopyTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yOffset,GLint x,GLin y,GLsizei width,GLsizei height)

void glCopyTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yOffset,GLint zOffset,GLint x,GLint y,GLsizei width,GLsizei height)

Use of colors in the data buffer is loaded, to form a new texture Use

void glCopyTexImage1D(GLenum target,GLint level,GLenum internalformt,GLint x,GLint y,GLsizei width,GLint border)

void glCopyTexImage2D(GLenum target,GLint level,GLenum internalformt,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)

//x,y 在颜⾊缓存区中指定了开始读取纹理数据的位置;
//缓存区⾥的数据,是源缓存区通过glReadBuffer设置的。

Absence glCopyTextImage3D, because we ⽆ volume data acquired from the 2D method of colors in the buffer area.

Surround shutter mode

/*
参数1:GL_TEXTURE_1D、GL_TEXTURE_2D、GL_TEXTURE_3D 
参数2:GL_TEXTURE_WRAP_S、GL_TEXTURE_T、GL_TEXTURE_R,针对s,t,r坐标 
参数3:GL_REPEAT、GL_CLAMP、GL_CLAMP_TO_EDGE、GL_CLAMP_TO_BORDER
*/
GL_REPEAT:OpenGL 在纹理坐标超过1.0的⽅向上对纹理进⾏重复;

GL_CLAMP:所需的纹理单元取⾃纹理边界或TEXTURE_BORDER_COLOR.

GL_CLAMP_TO_EDGE 环绕模式强制对范围之外的纹理坐标沿着合法的纹理单元的最后⼀⾏或者最后⼀列来进⾏采样。

GL_CLAMP_TO_BORDER:在纹理坐标在0.0到1.0范围之外的只使⽤边界纹理单元。边界纹理单元是 作为围绕基本图像的额外的⾏和列,并与基本纹理图像⼀起加载的。

glTextParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAR_S,GL_CLAMP_TO_EDGE)
glTextParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAR_T,GL_CLAMP_TO_EDGE)

With reference to the following figure:


2421768-06facaaa050a513f.png
Surround mode .png

2421768-3de1cdc5b5c10ab2.png
Surround effect as .png

Guess you like

Origin blog.csdn.net/weixin_33733810/article/details/90829762