2021電腦圖學 Computer Graphics 授課教師: 葉正聖 銘傳大學資訊傳播工程系 每週主題: 程式環境、點線面顏色、移動/旋轉/縮放與矩陣(Matrix)、階層性關節轉動(T-R-T)、做出機器人、打光、貼圖、glu/glut函式、鍵盤、滑鼠、計時器(timer)、讀入3D模型、粒子系統、聲音、特效、投影矩陣、攝影機與運鏡、機器人2.0、期末作品
2021年3月31日 星期三
懶嵐\(。∀ ° )/ Week06
NEKO no Computer Graphics_week06
今天不放封面了
首先畫一個正方形,讓它旋轉
然後先處裡細節的部份
畫一個藍色長條
glScalef(x,y,z) 改變cube的變形
三乙班代徐崇期生日快樂0331電腦圖學林裕宸
轉轉條方
#include <GL/glut.h>
float angle=0;
static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle,0,0,1);
glTranslatef(0.25,0,0);
glScalef(0.5,0.1,0.1);
glColor3f(0,0,1);
glutSolidCube(1);
glPopMatrix();
glutSwapBuffers();
angle++;
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("轉轉方!!");
glutDisplayFunc(display);
glutIdleFunc(display);
glutMainLoop();
}
再白白方上面轉轉藍方
有手臂了
兩隻手臂
電腦圖學week06
欸幹你看,是圖學欸Week06
#include <GL/glut.h>float angle=0;void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle,0,0,1);
glutSolidCube(1); glPopMatrix(); glutSwapBuffers(); angle++;}int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("08160793 good!");
glutDisplayFunc ( display );
glutIdleFunc(display);
glutMainLoop();
}
#include <GL/glut.h>float angle=0;void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle,0,0,1); glScalef(0.5,0.1,0.1); glColor3f(0,0,1); glutSolidCube(1); glPopMatrix(); glutSwapBuffers(); angle++;}int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("08160793 good!");
glutDisplayFunc ( display );
glutIdleFunc(display);
glutMainLoop();
}
#include <GL/glut.h>float angle=0;void hand(){ glPushMatrix(); glScalef(0.5,0.1,0.1); glColor3f(0,0,1); glutSolidCube(1); glPopMatrix();}void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle,0,0,1); glScalef(0.5,0.1,0.1); hand(); glPopMatrix(); glutSwapBuffers(); angle++;}int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("08160793 good!");
glutDisplayFunc ( display );
glutIdleFunc(display);
glutMainLoop();
}
#include <GL/glut.h>float angle=0;void hand(){ glPushMatrix(); glScalef(0.5,0.1,0.1); glColor3f(0,0,1); glutSolidCube(1); glPopMatrix();}void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1,1,1); glutSolidCube(1); glPushMatrix(); glTranslatef(0.5,0.5,0); glRotatef(angle,0,0,1); glTranslatef(0.25,0,0); hand(); glPopMatrix(); glutSwapBuffers(); angle++;}int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("08160793 good!");
glutDisplayFunc ( display );
glutIdleFunc(display);
glutMainLoop();
}
#include <GL/glut.h>float angle=0;void hand(){ glPushMatrix(); glScalef(0.5,0.1,0.1); glColor3f(0,0,1); glutSolidCube(1); glPopMatrix();}void display()/////容易出錯 glPushMatrix() or glPopMatrix(){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1,1,1); glutSolidCube(1); glPushMatrix(); glTranslatef(0.5,0.5,0); glRotatef(angle,0,0,1); glTranslatef(0.25,0,0); hand(); glPushMatrix(); glTranslatef(0.25,0,0); glRotatef(angle,0,0,1); glTranslatef(0.25,0,0); hand(); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); angle++;}int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("08160793 good!");
glutDisplayFunc ( display );
glutIdleFunc(display);
glutMainLoop();
}
#include <GL/glut.h>float angle=0;void hand(){ glPushMatrix(); glScalef(0.5,0.1,0.1); glColor3f(0,0,1); glutSolidCube(1); glPopMatrix();}void display(){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1,1,1); glutSolidCube(0.5); glPushMatrix(); glTranslatef(0.25,0.25,0); glRotatef(angle,0,0,1); glTranslatef(0.25,0,0); hand(); glPushMatrix(); glTranslatef(0.25,0,0); glRotatef(angle,0,0,1); glTranslatef(0.25,0,0); hand(); glPopMatrix(); glPopMatrix();
glPushMatrix(); glTranslatef(-0.25,0.25,0); glRotatef(-angle,0,0,1); glTranslatef(-0.25,0,0); hand(); glPushMatrix(); glTranslatef(-0.25,0,0); glRotatef(-angle,0,0,1); glTranslatef(-0.25,0,0); hand(); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); angle++;}int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("08160793 good!");
glutDisplayFunc ( display );
glutIdleFunc(display);
glutMainLoop();
}變兩隻手手了
距地表面160 Week11
#include "glm.h" GLMmodel* pmodel = NULL; void drawmodel(void) { if (!pmodel) { pmodel = glmReadOBJ("data/porsche.obj...
-
#include "glm.h" GLMmodel* pmodel = NULL; void drawmodel(void) { if (!pmodel) { pmodel = glmReadOBJ("data/porsche.obj...
-
加背 景 上程式碼 #include <opencv/highgui.h> ///使用 OpenCV 2.1 比較簡單, 只要用 High GUI 即可 #include <opencv/cv.h> #include <GL/glut.h>...
-
1. 3D Explorer安裝, 解壓、開Gundam 的 OBJ檔 SaveAs .cpp檔(SampleAPP) 2. CodeBlocks開OpenGL專案 2.1. main.c換 gundam_3dexp.cpp (放同目錄裡) 切換 Remo...





















