Monday, June 29, 2009

My Windows Extras

A list of software I use to make me feel more at home in Windows:

AutoHotkey Customize keyboard shortcuts and automate common actions. (Apparently advanced window management is possible...KDE Mover-Sizer is based on this).
CDBurnerXP (iso and gap-less Audio CD burning)
Filezilla (SFTP)
Firefox (web browser, can be extended with plugins)
- Vimperator (vim bindings, link numbering/hints)
- Adblock Plus (blocks ads)
- Custom Download Manager (stop download window from popping up)
- Colorful Tabs (tab colors)
Foobar2000 (minimalistic/functional media player replacement; never mind, I like WinAmp better)
GMail Notifier Plus (checks gmail, displays with Windows 7's jump lists)
GVim (programmer/admin's text editor)
KDE Mover-Sizer (move and resize windows by alt-clicking anywhere in window)
Notepad++ Coder/Admin text editor with a less...unique...control-scheme than GVim. Also, handles working off of UNC shares better (gvim frequently locks up for half a minute or so).
Paint.NET (somewhere between Paint and Photoshop)
Pidgin (AIM, GTalk)
Process Explorer (a much better Task Manager)
PuTTY (SSH)
SMplayer (video player; linux's mplayer w/GUI)
Steam (Games)
Sumatra PDF Viewer (no-nonsense PDF viewer)
TortiseSVN (SVN)
VirtualBox (virtualization: lets you run other OSs at the same time as Windows; supports 3D acceleration!)
WinAmp (watch folders, jump to file, global hotkeys...everything I want in a music player)
WinRAR (zip,rar,tar,etc; nag screen, but never expires)
WMP Keys (global hotkeys for Windows Media Player; since rendered unnecessary WinAmp)

My mac extras

A list of software I use to make me feel more at home in OS X (for next time I reinstall...):

Adium (AIM, GTalk)
Cyberduck (SFTP)
DarwinPorts (UNIX apps for Mac; from source)
Display Sleeper (immediately put iMac display to sleep)
DoubleCommand (fixes some annoying keyboard issues, such as enabling PC-style home/end)
Firefox (web browser, can be extended with plugins)
- Vimperator (vim bindings)
- Adblock Plus (blocks ads)
- Custom Download Manager (stop download window from popping up)
Google Notifier (automatically checks gmail)
Perian (codecs for quicktime, make it usable)
Quicksilver (many-featured launcher, including a plugin for iTunes)
Spark (bind hotkeys to applescripts, iTunes actions, and application launches)
Terminal
- Terminal.app Tab Namer (Change tab names)
- Terminal Colours (fix that unreadable blue, adjust other colors to liking)
- Visor ("quake-style" terminal summoned/dismissed via hotkey)
TinkerTool (misc hidden OS X preferences, including disabling 3D dock effect)
VLC (play/stream video)

Wednesday, June 10, 2009

Global hotkeys in Windows Media Player

The main reason I used to use Winamp was for a feature called "global hotkeys". This let me assign arbitrary keys to play/pause, fast forward, etc, while Winamp was minimized (it even worked while playing full-screen games!) Turns out you can do the same thing (for my purposes, at least) in Windows Media Player with something called WMP Keys. (Instructions on linked page.)

Monday, June 1, 2009

Matrix transformations and gluLookAt in Cg

OpenGL has some nice helper functions for matrix manipulation: glTranslate, glRotate, and glScale.

GlRotate is especially involved, so I made a version in Cg (based on the matrix in the spec):

float4x4 getRotateMatrix(float theta, float3 axis) {
float x = axis.x, y = axis.y, z = axis.z, c = cos(theta), s = sin(theta);
float4x4 matrix = float4x4(
x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s, 0,
y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s, 0,
x*z*(1-c)-y*s, y*z*(1-c)+x*s, z*z*(1-c)+c, 0,
0, 0, 0, 1
);
return matrix;
}


Another especially useful function is gluLookAt, which lets you specify camera position and tell it to look at a specific point. I downloaded the Mesa3D code and made the following Cg function based on it:

float4x4 getLookAt(float3 eye, float3 center, float3 up) {
float3 forward = normalize(center - eye);
float3 side = normalize(cross(forward, up)); /* Side = forward x up */
up = cross(side, forward); /* Recompute up as: up = side x forward */

return float4x4(
side.x, up.x, -forward.x, -eye.x,
side.y, up.y, -forward.y, -eye.y,
side.z, up.z, -forward.z, -eye.z,
0, 0, 0, 1
);
}

Thursday, May 28, 2009

Using opengl, glut, and cg with Visual Studio

These pages describe the process (the first one is out of date, but the changes to directory structure are minor):

OpenGL and GLUT
Cg

In case those pages go away, it boils down to this:

GLUT

  • Get GLUT for Win32

  • Copy...


    • glut32.dll to %WinDir%\System

    • glut32.lib to $(VSDir)\VC\lib

    • glut.h to $(VSDir)\include\GL


  • ...where $(VSDir) is something like C:\Program Files\Microsoft Visual Studio 9.0\VC


Cg


Visual Studio

  • Make a new Win32 Console Application project: File->New Project->Visual C++->Win32->Win32 Console Application

    • In the "Application Settings" page of the wizard, make sure Application type is Console Application and Empty project (under Additional options) is checked.

  • Go to Project->(project name) Settings


    • Set Configuration to All Configurations

    • Expand Configuration Properties

    • In C/C++->General, add $(CG_INC_PATH) to Additional Include Directories

    • In Linker->General, add $(CG_LIB_PATH) to Additional Library Directories

    • In Linker->Input, add opengl32.lib glu32.lib glut32.lib cg.lib cgGL.lib to Additional Dependencies


Friday, May 22, 2009

Changing vertex processing inside glBegin()/glEnd()

It appears you CAN NOT change shaders in the middle of a glBegin()/glEnd() block. That is, the following code will not switch between vert_main and vert_shadow:

glBegin(GL_TRIANGLE_STRIP); {
for (int v = 0; v < 4; v ++) { cgGLBindProgram(vert_main); glVertex3fv(VERTS[FACES[f][v]].xyz); cgGLBindProgram(vert_shadow); glVertex3fv(VERTS[FACES[f][v]].xyz); } } glEnd();


Looks like I *should* have seen this in the documentation: "Only a subset of GL commands can be used between glBegin and glEnd."

OS X as guest under Linux?

Here I will chronicle some attempts to run OS X as a guest OS on Linux.

My preference would be to use Sun's VirtualBox, since it looks pretty slick and is free. First, looks like I'll need an iso. Not sure if this requires special changes to the iso, or if a straight rip from a legit disk will work. I'm going to look for an iso online for now.

Ubuntu on Mac hardware info
https://help.ubuntu.com/community/MacBookAir1-1/Intrepid?action=show&redirect=Macbook_Air

Qemu
An interesting other note: someone on Ubuntu forums claims to have it working with Qemu, although there is no proof or additional info:

"I have a running OS X on Qemulator (Qemu+KQemu)

qemu -M pc -hda /home/juancarlospaco/OSX -soundhw ac97 -m 1024 -cdrom /home/juancarlospaco/10.5.5/10.5.5.iso -net nic,vlan=0 -net user,vlan=0,hostname=OSX -boot d"

stay tuned...