OpenGL Texture Mapping Filtering & Environment Parameters

Wrapping parameters (CLAMP | CLAMP_TO_EDGE | GL_REPEAT | GL_MIRRORED_REPEAT)

// Square Texture Coordinates
squareTextureCoords.push_back(glm::vec2
(-1.0f, -1.0f));
squareTextureCoords.push_back(glm::vec2(3.0f, -1.0f));
squareTextureCoords.push_back(glm::vec2(3.0f, 3.0f));
squareTextureCoords.push_back(glm::vec2(-1.0f, 3.0f));

//(왼쪽 아래)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

//(오른쪽 아래)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

//(왼쪽 위)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

//(오른쪽 위)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);

사용자 삽입 이미지



Magnification/Minification/Mipmap filter parameters (NEAREST | LINEAR)

//(위왼쪽)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);

//(위오른쪽)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

//(아래왼쪽)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

//(아래오른쪽)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

사용자 삽입 이미지

Leave a Reply

Your email address will not be published. Required fields are marked *