Programming/openGL

opengl texture

구차니 2025. 5. 30. 09:14

어렵다. 함수들 하나하나 찾아보고 머하는건지 맞춰봐야 할 듯.

 

Name
glGenTextures — generate texture names

C Specification
void glGenTextures( GLsizei n,
  GLuint * textures);
 
Parameters
n
Specifies the number of texture names to be generated.

textures
Specifies an array in which the generated texture names are stored.

[링크 : https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGenTextures.xhtml]

 

Name
glBindTexture — bind a named texture to a texturing target

C Specification
void glBindTexture( GLenum target,
  GLuint texture);
 
Parameters
target
Specifies the target to which the texture is bound. Must be one of GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER, GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY.

texture
Specifies the name of a texture.

[링크 : https://registry.khronos.org/OpenGL-Refpages/gl4/html/glBindTexture.xhtml]

 

void glTexStorage2D( GLenum target​, GLint levels​, GLint internalformat​, GLsizei width​, GLsizei height​ );
Valid target​s: GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP, or GL_TEXTURE_1D_ARRAY.
For 1D array textures, the number of array layers in each mipmap level is the height​ value. For rectangle textures, the number of mipmap levels must be 1.
void glTexStorage3D( GLenum target​, GLint levels​, GLint internalformat​, GLsizei width​, GLsizei height​, GLsizei depth​ );
Valid target​s: GL_TEXTURE_3D, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP_ARRAY (this requires GL 4.0 or ARB_texture_cube_map_array)
For 2D array textures, the number of array layers in each mipmap level is the depth​ value.
For 2D cubemap array textures, the number of cubemap layer-faces is the depth​, which must be a multiple of 6. Therefore, the number of individual cubemaps in the array is given by depth​ / 6.

[링크 : https://www.khronos.org/opengl/wiki/Texture_Storage]

 

glTexImage2D(GL_TEXTURE_RECTANGLE, 0, internalformat​, width​, height​, 0, format​, type​, data​);

[링크 : https://www.khronos.org/opengl/wiki/Rectangle_Texture]