2022年6月7日 星期二

A

 week16

1. alpha 內插公式: 0.0 ~ 1.0 ➡ angle=alpha*新角度+(1-alpha)*舊角度

2-1.複製上週 week15-angle-TRT-again 程式碼 

檔名: week16-interpolation

2-2.改善按r之後動作不連續的狀況,利用alpha內插法




程式碼:#include <GL/glut.h>

void reshape(int w,int h){
    const float ar = (float) w / (float) h;

    glViewport(0, 0, w, h);///3D變2D
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60,ar,0.1,100);

    glMatrixMode(GL_MODELVIEW);///3D Model+View
    glLoadIdentity() ;
    gluLookAt(0,0,3,
              0,0,0,
              0,1,0
              );
}
void display(){
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glutSolidTeapot(1);
    glutSwapBuffers();
}
int main(int argc,char** argv){
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("week16");

    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMainLoop();
}





沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...