All posts by kpark

실습작품

HW1 – 무피즈 (강현석)사용자 삽입 이미지
HW1 – 무피즈 (백승대)사용자 삽입 이미지HW2 – 캐릭터 (박찬호)사용자 삽입 이미지HW2 – 캐릭터 (원종찬)사용자 삽입 이미지HW2 – 캐릭터 (박재희)사용자 삽입 이미지HW3 – 캐릭터 동산 (정효진)사용자 삽입 이미지HW3 – 캐릭터 동산 (심지흠)사용자 삽입 이미지HW3 – 캐릭터 동산 (심세용)사용자 삽입 이미지




OpenGL Blending

Blending 예제
http://dis.dankook.ac.kr/lectures/cg08/entry/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);
 glBegin(GL_QUADS);
  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-multitexturing사용자 삽입 이미지singpass-multitexturing사용자 삽입 이미지
Billboarding
http://dis.dankook.ac.kr/lectures/cg09/entry/OPENGL-Billboarding

Before Billboarding사용자 삽입 이미지
After Billboarding사용자 삽입 이미지