- Sep 06 Thu 2012 08:33
-
還差得遠
- Aug 29 Wed 2012 07:15
-
OpenNI 抓取深度值
- Aug 28 Tue 2012 10:00
-
OpenNI 環境設置
- Aug 20 Mon 2012 08:18
-
ASUS Xtion Pro / Xtion Pro Live

Xtion PRO規格
有效距離:0.8 公尺 – 3.5 公尺
有效角度:58° H、45° V、70° D
介面/電源:USB 2.0
感測器:RGB & 深度
支援平台:Intel x86 & AMD
支援作業系統:程式語言:C++/C#(Windows)、C++(Linux)
- Win 32/64: XP、Vista、Win7
- Linux Ubuntu 10.10: x86 32/64bit
音效:內建兩組麥克風
- Jul 18 Wed 2012 09:34
-
rendering pipeline
顏色運算可以用加法、乘法,或是分量乘法
D3DX 提供 D3DXCOLOR 結構來表示顏色,分量乘法提供 D3DXColorModulate
- Jul 04 Wed 2012 06:19
-
HLSL
1. 如果顯卡不支援 vertex shader & pixel shader,必須改用 REF 裝置(D3DCREATE_SOFTWARE_VERTEX-PROCESSING)來模擬,但執行速度會大幅下降
- Jul 03 Tue 2012 21:32
-
心曠神怡
- Jun 20 Wed 2012 06:06
-
ref. V() / V_RETURN() (Handle Errors with DXUT)

Direct3D API 處理錯誤的方法很簡單,大部份 Direct3D API 回傳一個 HRESULT 結果表示測試成功 or 失敗,最常見的 failing 就是 D3DERR_INVALIDCALL,是當傳入的參數數量或型態錯誤導致。
處理錯誤方面,DXUT 與 Direct3D API 非常相似。如果不是會導致整個程式當掉方面的嚴重錯誤,就會產生 dialog box 顯示 debug build
DXUT 將這些巨集定義在 DxStdAfx.h 裡:
- Jun 20 Wed 2012 05:52
-
ref. 可變參數函數
一個可變參數函數是指一個函數擁有不定引數,即是它接受一個可變數目的參數。不同的程式語言對可變參數函數的支持有很大差異。
一般而言,在設計函數時會遇到許多數學和邏輯操作,是需要一些可變功能。例如,計算數字串的總和、字元串的聯接或其他操作過程,都可以存在任意數量的引數。
另一種許多語言都實現為可變參數函數的是格式輸出函數,在C語言的printf函數和Common Lisp的format函數就是例子。這些函數都需要一個參數,指定格式的輸出,再讀取可變參數的值進行格式化。
C/C++
在C語言中,C標準函式庫的stdarg.h標頭檔定義了提供可變參數函數使用的巨集。在C++,應該使用標頭檔cstdarg。
要創建一個可變參數函數,必須把省略號(...)放到參數列表後面。函數內部必須定義一個va_list變數。然後使用va_start、va_arg和va_end來讀取。例如:
#include <stdarg.h> double average(int count, ...){ va_list ap; int j; double tot = 0; va_start(ap, count); //使va_list指向起始的參數 for(j=0; j<count; j++) tot+=va_arg(ap, double); //檢索參數,必須按需要指定類型 va_end(ap); //釋放va_list return tot/count;}
這個是一段計算平均數的程式碼,可以輸入任意數量的小數並計算平均數。請注意,函數不知道參數的數量或它們的類型,這裡要求的類型是double,而且第一個參數傳遞可變參數的數量。在另外的情況下,例如printf,參數的數量和類型都設定在格式字元串中。在這兩種情況下,程序員實際上需要提供正確的參數,如果參數傳遞少了或參數的類型不正確,導致讀入內存的無效區,這樣會有安全漏洞如格式字元串攻擊。
- Jun 13 Wed 2012 10:16
-
8. Introduce to DXUT
它簡化了建立視窗、建立 Direct3D device、處理 windows messages 的程序,使我們可以更輕易的寫程式。
DXUT 的核心包含了建立視窗、建立 device、管理 functions 的標準程序。
- Jun 05 Tue 2012 15:27
-
CALLBACK attribute
CALLBACK function 本質上是實作給系統呼叫用的。一般 windows 應用程式都會實作多個 callback function,每個都對應到不同的 events。當事件發生時,系統會通知應用程式呼叫對應的 callback function。callback function 通常會有自己的參數列,提供系統傳關於 event 細部的參數或資訊。最常見的 callback function 例子就是 windows procedure。這個函式被系統用來把視窗的訊息傳遞給應用程式。DirectX 會依需求去實作不同的 callback function。
Implementing a Callback Function
Because callback functions have different purposes and usage, they are documented in the appropriate reference section in much the same way as a regular function. However, a callback function reference is essentially a template that describes how to implement the function, and it is not a normal API reference. The callback function reference provides the following information:
How the function is used
The function's syntax
An explanation of the information that will be contained by each parameter
An explanation of the possible return values
You should declare the function type as CALLBACK or WINAPI. Either type is acceptable. You can use any function name. The name used in the documentation is just a convenient label for a particular callback function.
Implement the function according to the description in the reference. The implementation details depend on the particular function and the requirements of your application. See the sample code for some examples of how to implement various callback functions.
Pass a pointer to the function to the appropriate DirectX component. The DirectX component can then use the function pointer to call the function. The way in which you pass this pointer varies from function to function, so you should see the particular function's reference for details.
The following code fragment is borrowed from the DirectInput Joystick sample. It sketches out the essential elements of implementing DIEnumDeviceObjectsCallback, a callback function that is used to enumerate the axes of a joystick.
// The function declaration BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ); ... // Pass the function pointer to DirectInput by calling the // IDirectInputDevice9::EnumObjects method if ( FAILED( hr = g_pJoystick->EnumObjects(EnumAxesCallback, (VOID*)hDlg, DIDFT_AXIS ))); ... // The function implementation BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ) { // Process the information passed in through the two parameters // Return DIENUM_CONTINUE to request the next device object // Return DIENUM_STOP to stop the enumeration } 