Tuesday, March 1, 2011

[Misc] Mixing Objective-C and C++

To use the C++ code in Objective-C, we can implement C++ class in pure C++. When using those C++ classes in Objective-C, any file having C++ types must have the extension of ".mm". Thus it seems not suitable to include C++ headers in Objective-C headers, although they are all ".h" files. 

Posted via email from Troy's posterous

Sunday, February 27, 2011

[OpenGL] FreeType and FTGL for Xcode

1) Download FreeType from: http://www.freetype.org and FTGL source from: http://sourceforge.net/projects/ftgl/

2) Extract the source and open a Terminal to navigate under the corresponding folder

3) For each do following steps in Terminal:
a) ./configure
b) make

4) find the libfreetype.a library file, for my case, it is under the folder of objs/.libs

5) copy the libfreetype.a and the include folder to a place, these are the files needed for apps;

6) Similarly for the FTGL, do ./configure, make and find the libftgl.a which is under src/.libs/

7) copy the libftgl.a and the folder FTGL under the src folder for future use.

For testing,

In Xcode, create a command-line app.

Copy the code from FTGL's demo folder's c-demo.c to the main.c of the newly created Xcode project.

drag libftgl.a, libfreetype.a and the header folders FTGL, freetype and the f2build.h to the project.


To compile the program we also need the "config.h" file from the FTGL's folder and add the OpenGL and GLUT frameworks.

Finally the result is :

Posted via email from Troy's posterous

Tuesday, February 22, 2011

[HMM] The GCONST in HTK's HMM definition file

The GCONST value is a precomputed constant for the log likelihood of the Gaussian, i.e. the log of the denominator of the Gaussian formula:
 

The stored GCONST is:


where for the diagonal covariance matrix, the determinant is just the product of the diagonal elements.

Posted via email from Troy's posterous

Google+