2013年12月14日 星期六

OpenGL 呼叫擴增函數出現 Memory violation

一般 if(glewInit() != GLEW_NO_ERROR) 正確後就可以使用擴增函數(比如 glGenBuffers()),但若是將 glew.c 加入專案中,或是把 glew.c 編譯成靜態程式庫來使用,就得須把用到 OpenGL 的每個模組(exe 和 dll)都要呼叫一次 glewInit(),還有要記得在主程式(exe)已先做好 opengl context,才能讓 glewInit() 成功執行。

glewInit() 主要任務在從驅動程式中把擴增函數的位址抽出來,放好到函數指標供應用程式使用。

另外若是直接使用  glew.c 或靜態程式庫,還得在專案中加上前置識別字 GLEW_STATIC。



2013年11月17日 星期日

photoshop 中英對照

File 文件
1.New 新建
2.Open 打開
3.Open As 打開為
4.Open Recent 最近打開文件
5.Close 關閉
6.Save 存儲
7.Save As 存儲為
8.Save for Web 存儲為Web所用格式
9.Revert 恢復
10.Place 置入
11.Import 輸入
1 PDF Image PDF圖像導入
2 Annotations 注釋
12.Export 輸出
13.Manage Workflow 管理工作流程
1 Check In 登記
2 Undo Check Out 還原註銷
3 Upload To Server 上載到伺服器
4 Add To Workflow 添加到工作流程
5 Open From Workflow 從工作流程打開
14.Automate 自動
1 Batch 批次處理
2 Create Droplet 創建快捷批次處理
3 Conditional Mode Change 條件模式更改
4 Contact Sheet 聯繫表
5 Fix Image 限制圖像
6 Multi Page PDF to PSD 多頁面PDF檔到PSD檔
7 Picture package 圖片包
8 Web Photo Gallery Web照片畫廊
15.File Info 文件簡介
16.Print Options 列印選項
17.Page Setup 頁面設置
18.Print 列印
19.Jump to 跳轉到
20.Exit 退出
Edit 編輯

2013年10月27日 星期日

ODE教學<四>矩陣資料

The Matrix Details



The ODE library uses a 3x3 matrix in mathematical notation, i.e. row first, column second. However, internally ODE stores
its matrices as a 4x4 ordered matrix, padded with 0's. The good news is that the dBodyGetRotation function we used to 
retrieve the rotation matrix in DrawGeom above returns a 4x3 rotation matrix. So the ODEtoOGL function transposes the
elements over to the OpenGL order (column first, row second) and plugs in the position vector into the 12th, 13th and
14th elements. 

ODE教學<三>幾何繪圖

Drawing The Geoms

At the end of the SimLoop function, after advancing the simulation one step and then deleting the contact joints, we called a function called DrawGeom. This function serves as a generic rendering routine for all types of geoms, using a different rendering function for each class of geom. In keeping with the examples that came with the ODE library, the DrawGeom function takes four parameters. The first is the geom's ID, then its position vector, rotation matrix and lastly a flag used to toggle the rendering of the geoms axis aligned bounding box. 

ODE教學<二>模擬迴圈simLoop

The simulation loop

要更新每個模擬畫面的函數我們叫做SimLoop,簡單來說,他負責計算幾何物件的碰撞然後重新顯示目前的幾何形狀 

void SimLoop()
{
    // dSpaceCollide負責計算空間中兩個幾何物件的可能的碰撞,
    // 我們必須提供callback函數的位置讓他來計算這些資料。
    // callback函數負責在加入碰撞節點前,評估可能的交互作用,碰撞節點的群組叫做contactgroup
    // 這讓我們在把碰撞節點加入到群組前,可以設定其可能行為
    // 第二個參數則是個指標指向任何我們想傳入callback函數的資料。
    // 下個章節我們會講到nearCallback。
    dSpaceCollide(Space, 0, &nearCallback);

    // 現在我們使用dWorldQuickStep來進行進階的模擬,這是dWorldStep的快速版本,但精確度會稍低。
    // 除了World物件ID之外,我們也將step size傳入,每個 step 會根據一個固定的數字的最小step或迭代來
    //更新模擬。
    // 預設次數為 20 但妳可以用dWorldSetQuickStepNumIterations來改變數值
    dWorldQuickStep(World, 0.05);

    //移除所有world中已發生過的暫時性的碰撞節點
    dJointGroupEmpty(contactgroup);

    // 當我們呼掉 DrawGeom 時,會根據物件的幾何形狀來繪出畫面
    DrawGeom(Object.Geom[0], 0, 0, 0);
}

Callback函數

ODE教學<一>初始化ODE



目前正在翻譯這篇,要轉載或幫忙翻譯請跟我說....
原文http://www.alsprogrammingresource.com/basic_ode.html


ODE是個物理的函數庫可以在虛擬世界模擬真實的物理現象,ODE的全名是Open Dynamics Engine而作者是Russell Smith,
是個開放程式碼的計畫,在此的ODE範例將會用免費的Dev-cpp來編譯。


這是個簡單的一個物件-一個盒子掉在一個平坦的表面,我們晚點再來講關節的部份,先來講ode include的部份。
#inlcude <ode/ode.h>

2013年10月21日 星期一

ubuntu 13.10 安裝 VMware tools

若安裝出現 Searching for a valid kernel header path...The path "" is not valid. Would you like to change it?
 的錯誤訊息沒法再繼續,依以下步驟就可解決

  1. Download linux headers using the command
    sudo apt-get update && sudo apt-get install build-essential linux-headers-$(uname -r)
  2. Create a symbolic link to version.h file
    sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h






2013年10月20日 星期日

注音、漢語拼音、通用拼音對應表


注音
漢語拼音
通用拼音
注音
漢語拼音
通用拼音
單獨出現
與其它音合併
單獨出現
與其它音合併
單獨出現
與其它音合併
單獨出現
與其它音合併
 
b
 
b
a
a
a
a
 
p
 
p
o
o
o
o
 
m
 
m
e
e
e
e
 
f
 
f
ê
 e
ê
 e
 
d
 
d
ai
ai
ai
ai
 
t
 
t
ei
ei
ei
ei
 
n
 
n
ao
ao
ao
ao
 
l
 
l
ou
ou
ou
ou
 
g
 
g
an
an
an
an
 
k
 
k
en
en
en
en
 
h
 
h
ang
ang
ang
ang
 
j
 
ji
eng
eng
eng
eng
 
q
 
ci
er
er
er
er
 
x
 
si
yi
i
yi
i
zhi
zh
jhih
jh
ㄧㄚ
ya
ia
ya
ia
chi
ch
chih
ch
ㄧㄛ
yo
yo
  -
shi
sh
shih
sh
ㄧㄝ
ye
ie
ye
ie
ri
r
rih
r
ㄧㄞ
yai
yai
-
zi
z
zih
z
ㄧㄠ
yao
iao
yao
iao
ci
c
cih
c
ㄧㄡ
you
iu
you
iou
si
s
sih
s
ㄧㄢ
yan
ian
yan
ian
         
ㄧㄣ
yin
in
yin
in
         
ㄧㄤ
yang
iang
yang
iang
         
ㄧㄥ
ying
ing
ying
ing
         
wu
u
wu
u
         
ㄨㄚ
wa
ua
wa
ua
         
ㄨㄛ
wo
uo
wo
uo
         
ㄨㄞ
wai
uai
wai
uai
         
ㄨㄟ
wei
ui
wei
uei
         
ㄨㄢ
wan
uan
wan
uan
         
ㄨㄣ
wen
un
wun
un
         
ㄨㄤ
wang
uang
wang
uang
         
ㄨㄥ
weng
ong
wong
ong
         
yu
ü
yu
yu
         
ㄩㄝ
yue
ue
yue
yue
         
ㄩㄢ
yuan
uan
yuan
yuan
         
ㄩㄣ
yun
un
yun
yun
         
ㄩㄥ
yong
iong
yong
yong
轉貼自 http://www.iq-t.com/SYSCOM/pinyin3.asp

2013年10月13日 星期日

CxxlMan 程式庫注意事項--不要在建構函數中將 this 放入 Smart_Ptr

如下:
A::A()
{
  Smart_Ptr(this);
}
這樣從建構函數返回後,A 的物件也會被銷毀,最常發生的情況應如下:
void F(const Smart_Ptr<A> &A_Arg); // 假設沒有用 Smart_Ptr 保存 A
A::A()
{
  F(this);
}
常不自覺就犯下那樣的錯誤。

2013年9月24日 星期二

cxxlOIS 元件

OIS 是一個跨平台的處理輸入裝置的函式庫,以物件導向的方式設計。OIS可以支援的輸入裝置主要是鍵盤、滑鼠、搖桿,同時也支援力回饋裝置--引言自 與Ogre共舞:第六步,敲敲鍵盤、動動滑鼠

由於編寫使用 OIS 的程式碼也蠻繁雜的,再加上為了搭配 CxxlMan 函數庫,所以寫了這個元件,把 OIS 包裝起來,並提供隨時更改 Event Handler 和 Windows 的 HWND 的能力。

2013年6月8日 星期六

CxxlSocket 通訊元件

這元件主要在簡化使用 Winsock 的程式設計,提供 Server 和 Client 兩個部份,Server 可接受多個 Client 的全雙工連線,並採取一般比較容易使用的 Event 機制。

內含原始檔及範例,請解壓到 C:\CxxlSocket 讓範例所用的路徑符合,下載點:
https://www.dropbox.com/s/guykgvnw383u5cj/CxxlSocket.7z

2013年5月16日 星期四

關於 OpenGL 和 D3D 的 major matrix

在許久以來的傳說...

OpenGL 採用如下的的矩陣運算,把它的矩陣稱作 colum matrices

     m11 m12 m13 m14  x
     m21 m22 m23 m24  y
     m31 m32 m33 m34  z
     m41 m42 m43 m44  1

而 D3D 採用如下的的矩陣運算,把它的矩陣稱作 row matrices
            m11 m12 m13 m14

       m21 m22 m23 m24
 x y z 1
       m31 m32 m33 m34

       m41 m42 m43 m44

但那是一個錯誤,那只能說是 "數學" 上的格式,實際上在程式記億體上的儲存方式如下...