Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Feb 7, 2011

How to build Clutter for Beagleboard (2)

Follow up with http://changetheworldwithyourpassion.blogspot.com/2009/09/how-to-build-clutter-for-beagleboard.html but with detail how to compile dependencies also

GLib

  • set PATH for the toolchain so that the configure can find the ARM gcc
  • Create a directory to store bin, lib, include of the builded-packages:
    • mkdir /data/opt
    • export MYPATH=/data/opt
  • Download and Extract glib-2.20.5, go to the extracted folder:
    ./configure --prefix=$MYPATH/glib --host=arm-angstrom-linux-gnueabi ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes glib_cv_stack_grows=no glib_cv_uscore=no
    make
    make install

Pixman

Download and extract pixman-0.17.8 into a folder.
./configure --prefix=$MYPATH/pixman --host=arm-angstrom-linux-gnueabi --enable-gtk=no
make
make install

Freetype

Download and extract freetype-2.3.12 into a folder
./configure --prefix=$MYPATH/freetype --host=arm-angstrom-linux-gnueabi
make
make install

Fontconfig

Download and extract fontconfig-2.8.0 into a folder
./configure --prefix=$MYPATH/fontconfig --host=arm-angstrom-linux-gnueabi --with-arch=arm --with-freetype-config=$MYPATH/freetype/bin/freetype-config PKG_CONFIG_PATH=$MYPATH/freetype/lib/pkgconfig/
make
make install

Cairo

Download and extract Cairo-1.8.10 into a folder
./configure --prefix=/$MYPATH/cairo --host=arm-angstrom-linux-gnueabi PKG_CONFIG_PATH=$MYPATH/freetype/lib/pkgconfig/:$MYPATH/fontconfig/lib/pkgconfig/:$MYPATH/pixman/lib/pkgconfig/ --enable-xlib=no --enable-directfb=no
make
make install

Pango

Build Pango-1.26.2:
./configure --prefix=$MYPATH/pango --host=arm-angstrom-linux-gnueabi PKG_CONFIG_PATH=$MYPATH/freetype/lib/pkgconfig:$MYPATH/fontconfig/lib/pkgconfig:$MYPATH/glib/lib/pkgconfig/:$MYPATH/cairo/lib/pkgconfig:$MYPATH/pixman/lib/pkgconfig/ CXX=mips-linux-c++ --with-x=no
make
make install

Clutter

Follow the http://changetheworldwithyourpassion.blogspot.com/2009/09/how-to-build-clutter-for-beagleboard.html then copy all to NFS and run the Clutter by yourself.

Have fun :-)

Sep 8, 2009

How to build Valgrind for Beagleboard

1) Get Valgrind source code from SVN using revision 9648 and 1888 for VEX
svn co -r 9648 svn://svn.valgrind.org/valgrind/trunk
cd VEX
svn update -r 1888


3) Apply the patch into the source code
cd valgrind
patch -p1 < [path to the patch]

4) Run autogen.sh to run autotools

5) Configure the source code
./configure --host=arm-angstrom-linux-gnueabi

The patch still has some bugs such as CPU instruction alignment you can 'cat /proc/cpu/alignment' to find out if the kernel is configured to fix unaligned accesses, and you can enable it by executing 'echo 2 > /proc/cpu/alignment' but it's enough to use for simple application.
Have fun with Valgrind :-)

Sep 4, 2009

How to build Clutter for Beagleboard

The Clutter need to be configured with =flavour=eglnative= so that it can work with SGX driver
The following is the configure command
./configure --with-flavour=eglnative --host=arm-angstrom-linux-gnueabi PKG_CONFIG=/data/workspace/OE/tmp/staging/i686-linux/usr/bin/pkg-config PKG_CONFIG_PATH=/data/workspace/OE/tmp/staging/armv7a-angstrom-linux-gnueabi/usr/lib/pkgconfig CFLAGS="--sysroot=/data/workspace/OE/tmp/staging/armv7a-angstrom-linux-gnueabi/ -I/data/workspace/OE/tmp/staging/armv7a-angstrom-linux-gnueabi/usr/include" --with-x=no --with-gles=1.1 --with-imagebackend=internal

with
  • --host: set the target for the build, need to be arm-angstrom-linux-gnueabi
  • PKG_CONFIG: use the pgk-config command from OE distribution
  • PKG_CONFIG_PATH: the path to search for *.pc file, need to be pointed to OE distribution
  • --with-x: not using X
  • --with-imagebackend: specific the image backend to use
  • --with-gles: specific the GLES version to use (1.1 or 2.0)
  • CFLAGS: override some C compiler flags
  • --sysroot: the root directory to search for library and header files
  • -I[include_dir]: some optional include directories to search for

Fix undefined rpl_malloc on autoconf tool in cross compile mode

When using autoconf tool in cross compile environment, sometime there is error like this `undefined reference to `rpl_malloc'`

It is the bug of autoconf tool in the test function AC_FUNC_MALLOC. To fix it we need define an environment variable that forces the test to pass. Define it in the environment prior to calling ./configure and the script will act as if the AC_FUNC_MALLOC check has passed.

export ac_cv_func_malloc_0_nonnull=yes

Aug 16, 2009

Draw Text with OpenGL and Cairo

The OpenGL just supports capability to draw primitive, not text. In order to draw text on screen we need support of other package such as Cairo or Pango. The following topic describe how to use Cairo with OpenGL.
1 First we need to create a Cairo surface for drawing (text)
2 Then we will load the surface into GL texture using glTextureXXX function
3 After all, we will apply texture mapping into our primitive (for example a rectangle for displaying text)


Create Cairo Context
inline cairo_t*
create_cairo_context (int width,
int height,
int channels,
cairo_surface_t** surf,
unsigned char** buffer)
{
cairo_t* cr;

/* create cairo-surface/context to act as OpenGL-texture source */
*buffer = (unsigned char*)calloc (channels * width * height, sizeof (unsigned char));
if (!*buffer)
{
printf ("create_cairo_context() - Couldn't allocate surface-buffer\n");
return NULL;
}

*surf = cairo_image_surface_create_for_data (*buffer,
CAIRO_FORMAT_ARGB32,
width,
height,
channels * width);
if (cairo_surface_status (*surf) != CAIRO_STATUS_SUCCESS)
{
free (*buffer);
printf ("create_cairo_context() - Couldn't create surface\n");
return NULL;
}

cr = cairo_create (*surf);
if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
{
free (*buffer);
printf ("create_cairo_context() - Couldn't create context\n");
return NULL;
}

return cr;
}

Draw text into the Cairo surface and then load it into GL Texture
inline int DrawText(int x, int y, int width, int height, char *string, COLOR &textColor, COLOR &background)
{
cairo_surface_t* surface = NULL;
cairo_t* cr;
unsigned char* surfData;
GLuint textureId;

/* create cairo-surface/context to act as OpenGL-texture source */
cr = create_cairo_context (256,
256,
4,
&surface,
&surfData);

/* clear background */
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
cairo_set_source_rgb(cr, background.red, background.green, background.blue);
cairo_paint (cr);

cairo_move_to(cr, 256/10, 256/2);
cairo_set_font_size(cr, 30);
cairo_select_font_face(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_source_rgb(cr, textColor.red, textColor.green, textColor.blue);
cairo_show_text(cr, string);

glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA,
256,
256,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
surfData);
TestEGLError("glTexImage2D");

free (surfData);
cairo_destroy (cr);

return textureId;

}

Texture Mapping
The texture mapping is so simple, we need to provide them the UV coordinate. The UV coordinate is range from 0 to 1 which 0 is the start point, and 1 is the end point. The following is an example usage


GLfloat textureCoord[] = {
f2vt(0.0f), f2vt(0.35f),
f2vt(1.0f), f2vt(0.35f),
f2vt(0.0f), f2vt(0.55f),
f2vt(1.0f), f2vt(0.55f)
};
COLOR clrText = {255,255,255};
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
GLuint textureId = DrawText(clipRect[0], clipRect[1], clipRect[2], clipRect[3], data, clrText, this->m_clrBackground);

glVertexPointer(2, VERTTYPEENUM, 0, rect);
glTexCoordPointer(2, VERTTYPEENUM, 0, textureCoord);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

glDeleteTextures(1, &textureId);

Aug 15, 2009

Enable 2D Over OpenGL

In OpenGL, if we want to 2D only, we can use the Ortho matrix to set ignore the z-list. The following code snippet demo how to do that

void
glEnable2D()
{
int vPort[4];

glGetIntegerv(GL_VIEWPORT, vPort);

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

glOrtho(0, vPort[2], 0, vPort[3], -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}

void glDisable2D()
{
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}

Aug 10, 2009

Boot beagleboard with S-Video output

Boot beagleboard with S-Video output

setenv bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait omapfb.mode=tv:1024x768-16@60 omapdss.def_disp=tv
mmcinit
fatload mmc 0:1 0x80300000
uImage-2.6.29 bootm 0x80300000

Aug 8, 2009

How To Share Network with Beagleboard through USB

1) Follow this link to setup network connection between Beagleboard and Host
2) Setup ip forwarding in the Host (linux)
echo "Remove any previous NAT setup"
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

echo "Setup NAT to forward packets from usb0 <---> eth0"
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface usb0 -j ACCEPT

echo "Enable packet forwarding in the kernel"
echo 1 >> /proc/sys/net/ipv4/ip_forward

3) In the board add route to the host
route add default gw 192.168.99.100

4) In the board set the DNS search to be same as the host so that it can resolve host to name
cat /etc/resolve.conf
nameserver 192.168.1.1

That's all :-)

How To Setup Beagleboard Network through USB

1) Boot up the board
2) In the board type
ifconfig usb0 [ip_here] netmask [mask here] up
i.e. ifconfig usb0 192.168.99.100 netmask 255.255.255.0 up
3) In the host environment (linux) type
ifconfig usb0 [ip_here] netmask [netmask here] up
ifconfig usb0 192.168.99.101 netmask 255.255.255.0 up

Then you can ssh to the board with `ssh root@192.168.99.100

Aug 1, 2009

Boot the Beagleboard with NFS through USB

You need a USB cable and serial cable to connect from Beagleboard to your Linux host
Install
- NFS
- bridge-utils

1) Add file ifcfg-usb0 into /etc/sysconfig/network-scripts/
DEVICE=usb0
IPADDR=192.168.99.100            # Replace with your Linux host's IP address
NETMASK=255.255.255.0
ONBOOT=no
TYPE=USB
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NM_CONTROLLED=no
TYPE=Ethernet

2) Add the ifcfg-br0 into /etc/sysconfig/network-script
# Ethernet Bridge
DEVICE=br0
ONBOOT=no
SEARCH="localhost"              # Replace with your search domains
BOOTPROTO=none
NETMASK=255.255.255.0           # Replace with your subnet's netmask
IPADDR=192.168.99.100           # Replace with your Linux host's IP address
USERCTL=no
PEERDNS=yes
IPV6INIT=no
GATEWAY=192.168.1.1             # Replace with your subnet's gateway
TYPE=Ethernet
DNS1=192.168.1.1                # Replace with your subnet's DNS
DOMAIN='localhost'                 # Replace with your Linux host's domain(s)
NM_CONTROLLED=no


4) Add br0 into /etc/init.d
#!/bin/bash

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

# Check if all what named needs running
start()
{
   /usr/sbin/brctl addbr br0
   /usr/sbin/brctl addif br0 eth0
   /sbin/ifup eth0
   /sbin/ifup br0
   return 0;
}

stop() {
   /sbin/ifdown br0
   /sbin/ifdown eth0
   /usr/sbin/brctl delbr br0
}


restart() {
 stop
 start
} 

# See how we were called.
case "$1" in
 start)
  start
  ;;
 stop)
  stop
  ;;
 restart)
  restart
  ;;
 *)
         echo $"Usage: $0 {start|stop|restart}"
  exit 3
esac

exit $RETVAL

3) Setup NFS: add following line to /etc/exports
/data/nfs *(rw,no_root_squash,no_all_squash,async)

4) Create directory /data/nfs and tar your root filesystem to /data/nfs

5) Type following commands to restart the NFS service
#service rpcbind restart
#service nfs restart

6) On BeagleBoard console type following command.
OMAP3 beagleboard.org # setenv bootargs console=ttyS2,115200n8 root=/dev/nfs rw nfsroot=192.168.99.100:/data/nfs ip=192.168.99.101::255.255.255.0 nolock,rsize=1024,wsize=1024 rootdelay=2

7) OMAP3 beagleboard.org # saveenv

8) OMAP3 beagleboard.org # mmcinit

9) OMAP3 beagleboard.org # fatload mmc 0 0x80300000 uImage

10) OMAP3 beagleboard.org # bootm 0x80300000

11) While the board is booting up, type ifconfig until you see the usb0 device is up. Then type `brctl addif br0 usb0`.

And enjoy the filesystem over NFS

Reference from http://elinux.org/Mount_BeagleBoard_Root_Filesystem_over_NFS_via_USB

Jul 20, 2009

How to cross compile Perl

Download Perl from www.perl.org and extract it into a folder
The go to that folder and type
sh ./Configure -des -Dusecrosscompile \
-Dtargethost=[ip of the target] \
-Dtargetdir=/cross/bin \
-Dtargetuser=[user to SSH to the target]
-Dtargetarch=arm-linux \
-Dcc=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-gcc \
-Dincpth=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/include \
-Dusrinc=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/include \
-Dlibpth=/opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/lib  
And then type make to build the Perl

The other solution which is simpler is as following
Download the http://www.rootshell.be/~axs/perl/ and extract it into existing Perl source code (5.10.0)

Then configure and compile it:
./configure --target=$target --sysroot=/mnt/target
make
make DESTDIR=... install

Jul 15, 2009

cygwin undefined reference to `_glEnd' and related OpenGL function

Sometime, when building OpenGL application under cygwin, we fail to compile with following message or relating OpenGL function message "undefined reference to `_glEnd' and related OpenGL function"

The simple test is such as following
#include <GL/gl.h>
int main() { glEnd(); return 0; }

$ gcc -lGL test.c -o test
/.../.../ccO7Cfcr.o:test.c:(.text+0x2b): undefined reference to `_glEnd'
collect2: ld returned 1 exit status

That is because the OpenGL library on cygwin is depended on GLU library also. We need to link with GLU when linking with GL
Change the link command to $ gcc -lGL -lGLU test.c -o test and everything is OK.

I met this issue while compiling ShivaVG package on cygwin

Jul 11, 2009

How to get stack trace of a function

In Java,
try {
throw new Exception();
} catch (Exception ex) {
ex.printStackTrace();
}

In C++, we'll use backtrace function as following (note: the backtrace does not exist in uClibc so that if you want to use, you must patch the library to enable it)

#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
void print_trace (void)
{
void *array[10];
size_t size;
char **strings;
size_t i;

size = backtrace (array, 10);

strings = backtrace_symbols (array, size);
printf ("Obtained %zd stack frames.\n", size);

for (i = 0; i < size; i++)
printf ("%s\n", strings[i]);
free (strings);
}


Or we can use sigsegv as followin http://www.tlug.org.za/wiki/index.php/Obtaining_a_stack_trace_in_C_upon_SIGSEGV

Jan 1, 2009

How to install Red5 Server with Tomcat

  • Download Java from http://www.sun.com
  • Install java into a folder such as /opt/red5/jdk-1.6.0
  • Set JAVA_HOME point to that folder
export JAVA_HOME=/opt/red5/jdk-1.6.0
cd /opt/red5
wget http://mirror-fpt-telecom.fpt.net/apache/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
tar -xf apache-tomcat-6.0.18.tar.gz
cd /opt/red5
wget http://www.red5.fr/release/0.7.0/war/Red5War_0.7.0.zip
tar -xf Red5War_0.7.0.zip
  • The 3 WARs file will be extracted
    • ROOT.war: the main Red5 application
    • admin.war: the Red5 admin page
    • echo.war: the echo sample application
  • Move 3 WARs into tomcat/webapps folder
cd /opt/red5
mv ROOT.war admin.war echo.war apache-tomcat-6.0.18/webapps
  • Remove the default ROOT application of Tomcat
cd /opt/red5/apache-tomcat-6.0.18/webapps
rm -rf ROOT
  • Create a start-server.sh file for easy to startup with following content
export JAVA_HOME=/opt/red5/jdk-1.6.0
export CATALINA_HOME=/opt/red5/apache-tomcat-6.0.18
export PATH=$JAVA_HOME/bin:$PATH
cd $CATALINA_HOME
./bin/startup.sh
  • Start Tomcat with start-server.sh
cd /opt/red5
./start-server.sh
  • Open the browser and browse to the following URL http://[ip]:8080/
  • The Red5 welcome page will be displayed
  • You can test the RTMP broadcast via web at http://[ip]:8080/demos/ofla_demo.html or via client application such as VideoLAN rtmp://[ip]/oflaDemo/DarkKnight.flv
  • You might want to create the stop-server.sh to stop Tomcat with following contents
export JAVA_HOME=/opt/red5/jdk-1.6.0
export CATALINA_HOME=/opt/red5/apache-tomcat-6.0.18
export PATH=$JAVA_HOME/bin:$PATH
cd $CATALINA_HOME
./bin/shutdown.sh

Dec 30, 2008

How to fix DNSChanger Malware

DNSChanger is a trojan designed to change DNS server address on computers that they are run on. This is done to redirect victims to fake websites that steal credit card information, logins and passwords for on-line banks and payment systems like PayPal.

The trojan modify some registry at TcpIp service and maybe it also adds some Windows service for monitoring...

To fix it
Option 1. Disable the DNS Client service (the service has no effect on client machine, it normally cache the DNS request to optimize)

Option 2. Download the CombFix http://download.bleepingcomputer.com/sUBs/ComboFix.exe and run, it'll automatically fix the issue for you.

Oct 23, 2008

How to Disable Steal Lock in Subversion

In Subversion, you can easily steal the lock that other user lock it. By using hook script, you can disallow user to do so. Just edit the pre-lock script as following

pre-lock.bat
The following is the content of pre-lock.bat which will work on Windows environment. Just copy the content and put it under the hook folder of your Subversion repository

@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set rev_path=%2
set userName=%3

:: If a lock exists and is owned by a different person, don't allow it
:: to be stolen (e.g., with 'svn lock --force ...').

FOR /F "delims=: tokens=1*" %%a IN ('svnlook lock "%repository%" "%rev_path%"') DO if %%a==Owner (set LOCK_OWNER=%%b)

:: If we get no result from svnlook, there's no lock, allow the lock to
:: happen:
if "%LOCK_OWNER%"=="" (
exit /b 0
)

:: If the person locking matches the lock's owner, allow the lock to
:: happen:
if "%LOCK_OWNER%" = " %username%" (
exit /b 0
)

:: Otherwise, we've got an owner mismatch, so return failure:
echo "Error: %rev_path% already locked by %LOCK_OWNER%." >&2
exit /b 1

Enable Edit Log Message in Subversion

In Subversion, when you commit the changeset, you're not allow to edit the log message but the SVN admin with svn-admin command.
To enable it to user, you (the SVN admin) must enable the pre-prop-change hook

pre-prop-change.bat (Windows)
Here is the content of pre-prop-change hook, just save it to pre-prop-change.bat and copy it into SVN hook folder. The content is Windows batch file and just for Windows environment

The script will enable the owner of the revision and the owner of SVN to change the log message.

The owner of SVN is get from SVN auth file (authz-svn.conf) and should be configure in the form @svn_owner = userA, userB...

You need to edit the PATH to authz-svn.conf file

@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5

:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME

:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION

:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY

FOR /F "tokens=*" %%a IN ('svnlook author "%repository%" -r %revision%') DO set REV_USER=%%a

FOR /F "delims== tokens=1*" %%a IN (%repository%\..\Permission\authz-svn.conf) DO if "%%a"=="svn_owner " ( set SVN_OWNER=%%b )

set bIsOK=false
FOR %%a IN (%SVN_OWNER%) DO if "%%a"=="%userName%" ( set bIsOK=true )
if "%bIsOK%"=="false" (
goto ERROR_AUTHOR
)

goto :eof

:ERROR_AUTHOR
echo You must be the author of the log message or owner of the repository %SVN_OWNER% %userName%. >&2
goto ERROR_EXIT

:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT

:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT

:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

pre-prop-change (Linux)
The following is the script in Linux, it just allow the owner of the revision to change the log.

#!/bin/sh

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ];
then
REV_USER=`svnlook author "$REPOS" -r $REV`
if [ "$REV_USER" = "$USER" ];
then
exit 0;
else
echo "You must be the owner of the revision to be able to change the svn:log property" >&2
exit 1
fi
fi

echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

Oct 15, 2008

How to copy music from PC to iPhone without using iTunes

How to copy music from PC to iPhone without using iTunes

Hehe, you will need to use the SharePod at http://www.getsharepod.com/ and everything will be solved ;-)

Aug 1, 2008

How To Compile C Code Analysis (CCA)

CCA is an analysis toolkit for analyzing C source code. The following show you how to compile CCA on Windows.
Prerequisite
  • Cygwin: gcc, ocaml, make
To Compile open Cygwin bash shell and run following command
cd cil
./configure
make
make quicktest
You might need to edit the Makefile.cil to remove the following lines (at line 259)

$(ECHO)#if test $(OBJDIR) != $(<D) -a -f $(OBJDIR)/$(basename $(<F)).cmi ;then \

$(COMMAND) mv -f $(OBJDIR)/$(basename $(<F)).cmi $(<D); \

mv -f $(OBJDIR)/$(basename $(<F)).cmi $(<D); \

fi

Jul 27, 2008

How To Create DirectX (.X) file

Using Tools
  • Get yourself a program named TrueSpace or Milkshape, which can export Models into this format (and create them)
  • Get a Plug in for any other 3D modeler (Maya Plugin and others are included with the DirectX9 SDK)
  • Create 3DS Files using almost Any Modeler (3DS is more or less a standard format) and use the Program supplied with the SDK to convert it into .X format
  • Open the File in WordPad and u can create/modify them, since they are not stored in any compressed/unreadable format (although for this u need to know how the file is build)
Programmatically
  1. Create the mesh
    D3DXCreateMeshFVF(...)
  2. Lock the vertex buffer and copy your vertices into it
    outMesh->LockVertexBuffer(...)
  3. Lock the index bufer and copy indices into it
    outMesh->LockIndexBuffer(...)
  4. Save it to a file
    D3DXSaveMeshToX(...)