# 2011년 봄학기 그래픽스 프로그래밍 기말고사 문제

2011년 봄학기 그래픽스 프로그래밍 기말고사 문제1274932161.pdf
2011년 봄학기 그래픽스 프로그래밍 기말고사 답안3336039515.pdf

# OpenGL Blending

Blending Filter 예제
http://dis.dankook.ac.kr/lectures/cg08/entry/blending-filter-예제

// Default (no blending) = Cs*1
glBlendFunc(GL_ONE, GL_ZERO)
// Draw background only = Cd*1
glBlendFunc(GL_ZERO, GL_ONE)  // Addition Blending = Cs*1 + Cd*1
glBlendFunc(GL_ONE, GL_ONE)
// Alpha blending (back-to-front) = Cs*As + Cd*(1-As)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)  // Brighten the scene = Cs*As + Cd*1
glBlendFunc(GL_SRC_ALPHA, GL_ONE)  // Multiplicative blending = Cd*Cs
glBlendFunc(GL_ZERO, GL_SRC_COLOR)// darken the scene = Cd*As
glBlendFunc(GL_ZERO, GL_SRC_ALPHA);// Invert all the colors = Cs*(1-Cd)
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO)

# OpenGL Texture Mapping

/// init texture
void initTexture(char *filename, GLuint& textureID, GLint param=GL_REPEAT)
{
// 중간 생략
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, param);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, param);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, numComponents == 3 ? GL_RGB : GL_RGBA, imageWidth, imageHeight,
0, numComponents == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, imageBuffer);
glBindTexture(GL_TEXTURE_2D, 0);
}

/// Draw
void draw()
{
glBindTexture(GL_TEXTURE_2D, texID1);
glNormal3f(0, 0, 1);
glTexCoord2i( __________________ );
glVertex3f(-2.0, -1.0, 0.0);
glTexCoord2i(__________________);
glVertex3f(-0.1, -1.0, 0.0);
glTexCoord2i(__________________);
glVertex3f(-0.1, 1.0, 0.0);
glTexCoord2i(__________________);
glVertex3f(-2.0, 1.0, 0.0);
glEnd();
}

# OpenGL Texture Mapping

Texture binding, texture generate, texture filtering, texture subimage, texture mapping by procedural definition & using imagefile, mipmapping, texture environment setting (modulate/decal), texture distorting, texture transformation, flipbook animation, etc
http://dis.dankook.ac.kr/lectures/cg08/entry/texture-mapping-예제

Texture filtering & environment paramaters
http://dis.dankook.ac.kr/lectures/cg08/entry/texture-filtering-environment-parameters-예제

wrapping parameters (REPEAT | CLAMP)

magnification/minification filter parameters (NEAREST | LINEAR | LINEAR_MIPMAP_LINEAR)

environment parameters (MODULATE | DECAL | BLEND | REPLACE)

Texture generation
http://dis.dankook.ac.kr/lectures/cg08/entry/texture-generation-예제

Multitexturing
http://dis.dankook.ac.kr/lectures/cg09/entry/OPENGL-Multitexturing

multipass-multitexturingsingpass-multitexturing
Billboarding
http://dis.dankook.ac.kr/lectures/cg09/entry/OPENGL-Billboarding

Before Billboarding
After Billboarding