Friday, October 25, 2013

opengl matrix, column major

When I implement lootat function with rotation and translation, I found out the opengl matrix is saved in column major, if you were using 1d array. 2d arrays are with the intuitive representations.

Thursday, October 24, 2013

Simple Makefile to compile and link all the cpp files in the folder

DEFINC := /usr/include/
LIBS := /usr/lib/
INC := $(DEFINC)


CXXFLAGS :=
CXXFLAGS = -I$(INC)
CXXFLAGS += -O2 -march=native
CXXFLAGS += -fPIC

LINK :=
LDFLAGS :=
LDFLAGS += -L$(LIBS) $(LINK)


CXX = g++
LD = g++

SRC := $(wildcard ./*.cpp)
OBJ := $(addprefix ./,$(notdir $(SRC:.cpp=.o)))
TARGET := test


all: $(TARGET)

$(TARGET): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^

obj/%.o: src/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

clean :
rm -rf ./*.o $(TARGET)

Thursday, September 12, 2013

PCM audio

PCM uses signed int to represent sound.U can generate a family of sin function samples, rescale them form -signed_int_max ~ signed_int_max, and convert them into a byte array. Android lib will play it.

Sunday, February 10, 2013

opencv python 64bit waitkey

There is a bug for opencv python api under 64 bit. cv2.WaitKey return a value other than a normal int. Maybe it is a long int.  Usually it is 1048576(0x100000) more than what it should be. I have to add numpy.int16(cv.WaitKey(10)) to fix it.

Friday, January 25, 2013

PhysX linux linking

PhysX offers binary static libs for linux. Linking static libs under linux is tricky. Order matters.

I found -lPhysx3 must be the first one.

Tuesday, January 1, 2013

Parse error at "BOOST_JOIN"

When I compiled RGBDemo/nestk, I got Parse error at "BOOST_JOIN" error. It happened when using cmake, qt4, and boost>1.47 while Qt4 moc was trying to moc boost.

Neither qt or boost community will fix this problem. There are 2 kinds of workarounds I find.

#1(I never tested)
Add
#ifndef Q_MOC_RUN
#endif
to exclude boost head files for qt moc.

#2
change cmake file from
QT4_WRAP_CPP(...)
to
QT4_WRAP_CPP(... OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)

With #2, rgbdemo compiled.