This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Library/Formula/opencv.rb b/Library/Formula/opencv.rb | |
index 8249202..94da337 100644 | |
--- a/Library/Formula/opencv.rb | |
+++ b/Library/Formula/opencv.rb | |
@@ -22,7 +22,9 @@ class Opencv <Formula | |
# There are other optional dependencies but they don't currently exist in Homebrew. | |
def install | |
- system "cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=#{prefix} ." | |
+ makefiles = "cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=#{prefix} ." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Import VTK with special EmbedOpenGL renderer | |
import os | |
os.environ['VTK_RENDERER'] = 'EmbedOpenGL' | |
import vtk | |
import time | |
from pymt import * | |
from OpenGL.GL import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) setupSockets { | |
void* info = (__bridge void*) self; | |
readsock = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM, | |
IPPROTO_UDP, kCFSocketReadCallBack | | |
kCFSocketAcceptCallBack | kCFSocketDataCallBack | | |
kCFSocketConnectCallBack | kCFSocketWriteCallBack, | |
(CFSocketCallBack)readSockCallBack, info); | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GLfloat* createSlices(unsigned int num_slices) { | |
// Each slice has 4 vertices (GL_TRIANGLE_STRIP) | |
unsigned long total_verts = num_slices * 4; | |
// Each vertex has 3 coordinates | |
unsigned long total_elements = total_verts * 3; | |
// We have 4 verts * 3 coords = 12 elements per slice | |
const GLfloat one_slice[12] = { | |
// x, y, z | |
1., 1., 0., |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Vertices drawn as GL_TRIANGLE_STRIP: | |
GLfloat d = 0.5f; | |
// We have 4 verts * 3 coords = 12 elements per slice | |
const GLfloat one_slice[12] = { | |
// x, y, z | |
-d, d, 0., | |
d, d, 0., | |
-d, -d, 0., | |
d, -d, 0., | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
float rotstep = ((M_PI / 2.) / 9.) / 2.; | |
GLKVector2 ndir = GLKVector2Normalize(direction); | |
_rx += ndir.y * rotstep; | |
if (_rx > M_PI_2) | |
_rx = M_PI_2; | |
if (_rx < -M_PI_2) | |
_rx = -M_PI_2; | |
_ry += ndir.x * rotstep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) setupSocket { | |
struct sockaddr_in addr; | |
bzero(&addr, sizeof(addr)); | |
addr.sin_len = sizeof(addr); | |
addr.sin_family = AF_INET; | |
// Ask kernel to randomly assign port | |
addr.sin_port = 0; | |
void* info = (__bridge void*) self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser | |
didFindService:(NSNetService *)netService | |
moreComing:(BOOL)moreServicesComing { | |
netService.delegate = self; | |
[netService scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; | |
[netService resolveWithTimeout:3.0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Doesn't work: | |
readsock = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, | |
IPPROTO_TCP, kCFSocketReadCallBack | | |
kCFSocketAcceptCallBack | kCFSocketDataCallBack | | |
kCFSocketConnectCallBack | kCFSocketWriteCallBack, | |
(CFSocketCallBack)&readSockCallBack, info); | |
// Works: | |
readsock = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, | |
IPPROTO_TCP, kCFSocketAcceptCallBack, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send: | |
const uint8_t query = (uint8_t)USERNAME_QUERY; | |
const uint8_t length = (uint8_t)sizeof(query); | |
[stream write:&length maxLength:sizeof(uint8_t)]; | |
[stream write:&query maxLength:length]; | |
// Receive: | |
uint8_t length; | |
[inStream read:&length maxLength:sizeof(uint8_t)]; |
OlderNewer