15 November 2012

transparent object (weird depth problem)



The possible causes are:
no glEnable(GL_DEPTH_TEST);
no glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); in every frame
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.0f,100.0f);
0 for near (should be 0.1f)

But the culprit of my problem is:
glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE ); 
which is called before you run openGL
If you don't put GLUT_DEPTH in here, depth won't be calculated!

To check whether you've defined depth or not in your program:
int depth;
glGetIntegerv(GL_DEPTH_BITS, &depth);
std::cout << "depth " << depth << std::endl;
if the result is 0, that means the depth is not defined.
This GL_DEPTH_BITS seems to be deprecated in openGL 3.3 / 4, though. I don't know what my version is but it worked (was 0, is now non 0).

I'm using gtkglarea, and the setting for it is:
int attrlist[] = {
    GDK_GL_RGBA,
    GDK_GL_RED_SIZE,1,
    GDK_GL_GREEN_SIZE,1,
    GDK_GL_BLUE_SIZE,1,
    GDK_GL_DOUBLEBUFFER,
    GDK_GL_DEPTH_SIZE,16,
    GDK_GL_NONE
};
which is used by  glArea = GTK_WIDGET(gtk_gl_area_new(attrlist)); to create new open widget in GTK.
Not sure why the size is 16, though, but putting on 32 results in a blank screen for mine.

Beware that some computer may work by default without this depth setting. Ugh. @_@

29 October 2012

[Mac] Photoshop in case-sensitive harddisk

Just found out that Photoshop apparently is not installable on Mac OSX with case sensitive volumes. Someone make a hack to make it work on one.

See the solution here. Installed smoothly.

Disregard of why one decide to have a case sensitive volumes, I don't understand why Adobe didn't put such (simple) hack to make it work, despite it being such a big company, with such expensive softwares...

22 October 2012

copy files of certain date range

copy files modified on 2012.10.13 only
find . -newermt "2012-10-12 23:59:59" -not -newermt "2012-10-14 00:00:00" -exec cp -p "{}" /tmp \;

08 October 2012

irssi

use irc from terminal.
worked on ubuntu and max OSX.

change nickname
/nick username

join a channel
/join #channel_name

list users in a channel
/names

make user an op
/msg chanserv op #channel_name username
/mode #channel_name +o username

auto connect
/server add -auto -network Freenode irc.freenode.net 6667
/network add -nick username Freenode
/channel add -auto #channel_name Freenode

05 October 2012

GLUT in Mac OSX

source

GL Header
#ifdef __APPLE__
#  include 
#  include 
#  include 
#else
#  include 
#  include 
#  include 
#endif

Makefile
# Mac OS alternate cmdline link options
UNAME = $(shell echo `uname`)
ifeq "$(UNAME)" "Darwin"
 LDFLAGS = -framework Carbon -framework OpenGL -framework GLUT
endif

GtkglArea

install from macport
sudo port install gtkglarea2

makefile (same as Ubuntu)
CPPFLAGS += `pkg-config gtkgl-2.0 --cflags`                                                                             
LIBS += `pkg-config gtkgl-2.0 --libs`   

01 October 2012

mts to avi

Program:
Any Video Converter (Free)

Problem:
slow/fast playback result for 60fps mts videos,
wrong frame ratio (is actually a 16:9)

Solution:
1. Edit -> Options -> Video -> Audio/Video Sync -> slide until 60
2. Frame Size = 1280 x 720
3. Video Framerate = Auto
4. A/V Sync = Default

04 September 2012

Pro Engineer tips

instead of deleting parts which would end up deleting the parts we'd like to save, suppressing the parts little by little can resolve this problem.
BUT. you cannot edit the file further.

remember to save first the assembly, with file->backup

when reopening there will be error, but can be fixed by using freeze.