SEC defines three types: 0x00 = point at infinity, 0x02 and 0x03 = compressed, 0x04 = uncompressed
02 basically means even y-point, 03 means odd y-point, thus:
uncompressed pubkey = chr(4) + 32-byte x + 32-byte y
compressed pubkey = chr(1 + (y & 1)) + 32-byte x
Also see
http://github.com/joric/pywallet (I updated it recently, now it supports compressed keys).
Using OpenSSL you just have to set point conversion via EC_KEY_set_conv_form().