2018年1月13日 星期六
2018年1月4日 星期四
Arthus week8
week8
Texture 貼圖
OPen CV的安裝,讀圖
open GL的貼圖設定
EX:轉動地球
open GL的貼圖設定
EX:轉動地球
到http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/下載data、windows、glut32、source把date和glut32.dll放入windows資料夾裡
到moodle中下載OpenCV-2.1.0-win32-vs2008.exe
安裝過程中選第3個選項
打開codeblocks開專案檔console application複製貼上
#include <opencv/highgui.h>
int main()
{
IplImage * img=cvLoadImage("earth.jpg");
cvNamedWindow("hello");
cvShowImage("hello", img);
cvWaitKey(0);
return 0;
}
codeblocks設定中改成->Build options->Search directories
Search directories->Compiler->Add directory : c:\opencv2.1\include
Search directories->Linker->Add directory : c:\opencv2.1\lib
Linker setting->Add library : cv210
Linker setting->Add library : cxcore210
Linker setting->Add library : highgui210
Search directories->Compiler->Add directory : c:\opencv2.1\include
Search directories->Linker->Add directory : c:\opencv2.1\lib
Linker setting->Add library : cv210
Linker setting->Add library : cxcore210
Linker setting->Add library : highgui210
下載圖檔並放到專案檔中
2017年11月30日 星期四
Arthus week12
week12
在moodle下載myGL_Frustum211_MultiView執行exe黨
打開glut專案黨執行程式碼並編譯
----------------------------------------------------------------------------------------------------------------
在moodle 下載processing在選單案速寫本選引用文件庫 並添加
關掉重開
選擇文件 範例程式
選contrubuted libraries
選collada 選viewer2d
執行
--------------------------------------------------------------
打開picking中的simple
執行
2017年10月26日 星期四
2017年10月19日 星期四
Arthus week6
week06
step1:下載glut32.dll windows.zip data.zip source.zip 並解壓縮到桌面
step2:去moodle下載week5
week5打開cbp檔
week5打開cbp檔
step3:去setting compiler 把c++11的勾勾取消
step4:執行
step5:打開transformation.c 搜尋light
step6 :打光程式碼
GLfloat pos[] = { 0.0, 0.0, -1.0, 0.0 };
GLfloat pos[] = { 0.0, 0.0, -1.0, 0.0 };
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
step7:執行
step8:加入keyboard mouse
#include<stdio.h>
.
.
.
void keyboard (unsigned char key, int x, int y){
.
.
.
void keyboard (unsigned char key, int x, int y){
printf("now:%c (%d %d)\n",key,x,y);}
void mouse (int button,int state ,int x, int y)
{
printf("now: %d %d (%d %d)\n",button,state,x,y);
}
在int main()
{
.
.
.
glutCreateWindow("week06");
glutDisplayFunc(display);
glutKeyboardFunc(Keyboard);
glutMouseFunc(mouse);
glutMainLoop();
}
step9:執行
keyboard讓東西轉
step10:加 int rotateX=0,rotateY=0,rotateZ=0
在keyboard function中加入
if(key=='1') rotateX++;
if(key=='2') rotateY++;
if(key=='3') rotateZ++;
glutPostRedisplay();///使得東西馬上更新
在display function中的drawmodol()前後加glPushMatrix()跟glPopMatrix()
並在前面加入
glRotatef(rotateX,1,0,0);
glRotatef(rotateY,0,1,0);
glRotatef(rotateZ,0,0,1);
讓物體旋轉
step11:執行
MOUSE讓東西轉
step12:先加入int oldX=0,oldY=0;
在mouse function中加入
if(state==GLUT_DOWN)
{
oldX=x;
oldY=y;
}
並新增
void motion(int x, int y)
{
rotateY+= -(x-oldX);
rotateX+= -(y-oldY);
oldX=x;
oldY=y;
glutPostRedisplay();
}
在main中新增glutMotionFunc(motion);
step13:執行
2017年10月12日 星期四
2017年10月5日 星期四
Arthus week4
2017年9月28日 星期四
Arthus week3
week3
1.小小兵
step1:下載學姐的檔案
step2:使用codeblocks的glut專檔開啟(先下載)
step3:使用編譯執行
完成!!!
2.3DExploration
step1:google 3DExploration並下載
step2:去jsyeh.org/3dcg10下載data
step3:打開3DExploration將data的檔案放入並存檔save as成cpp
然後選simple app
step5:編譯並執行
完成拉!!!!~~~~
2017年9月21日 星期四
Arthus Week2
親手打造的第一個茶壺圖學程式
step1:打開一個glut專案檔
step2:刪減程式碼到剩下這樣
step3:新增一個茶壺的程式碼
glutSolidTeapot(0.3)
step4:為茶壺加上顏色(打在茶壺的程式碼之前)
glColor3f(R,G,B)
[3f代表三個顏色的浮點數]
[RGB範圍從1~0]
step5:執行
完成!!!!!!
訂閱:
文章 (Atom)