2013년 봄학기 그래픽스 프로그래밍 기말고사 문제
2013년 봄학기 그래픽스 프로그래밍 기말고사 답안 (updated by 2013/06/17)
OpenGL Blending Filter 6436101960.zip
OpenGL TimeVaryingAlphaTexture 7559445566.zip
OpenGL AlphaTextureSquare 6598535561.zip
lecture17-ch8 5826410474.pdf
http://dis.dankook.ac.kr/lectures/cg12/entry/OpenGL-Multi-Texturing ADD MODULATE Single Pass Multi-Texturing (Activating Multiple Texture Coordinates using GLSL) 4738572556.zip Multi-Pass Multi-Texturing (Using Blending) 5764603540.zip
Texture Animation 5974008442.zip // init 중간생략..
for (int i=0; i<7; i++) { char filename[255]; sprintf(filename, “tacgun0%d.rgb”, i); texture[i] = InitTexture(filename); }
// draw 중간생략..
glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture[currentTex ]); drawSquare(); glBindTexture(GL_TEXTURE_2D, 0);
// update
void update() { static int currentTime, deltaTime, prevTime = 0; currentTime = glutGet(GLUT_ELAPSED_TIME); deltaTime = currentTime – prevTime; prevTime = currentTime; currentTex = (GLuint) ((float)currentTime * 0.01) % 7; glutPostRedisplay(); }
Automatic mipmap generation
Mipmaps of a texture can be automatically generated with the glGenerateMipmap function. OpenGL 3.0 or greater is required for this function (or the extension GL_ARB_framebuffer_object). The function works quite simply; when you call it for a texture, mipmaps are generated for that texture:http://www.opengl.org/wiki/Common_Mistakes#Automatic_mipmap_generation
glTexImage2D(GL_TEXTURE_2D, 0, numComponents == 3 ? GL_RGB : GL_RGBA, imageWidth, imageHeight, 0, numComponents == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, imagePtr); glGenerateMipmap(GL_TEXTURE_2D); // Generate mipmaps now!! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 4);
lecture16-ch8 (updated) 9935489143.pdf
Posts navigation
Just another Kyoung Shin Park’s Lectures Sites site