| 1 |
#include "uirendersyphon.h" |
| 2 |
#import <Syphon/Syphon.h> |
| 3 |
|
| 4 |
UiRenderSyphon::UiRenderSyphon() { |
| 5 |
mSyphon = nil; |
| 6 |
} |
| 7 |
|
| 8 |
UiRenderSyphon::~UiRenderSyphon() { |
| 9 |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; |
| 10 |
|
| 11 |
[(SyphonServer *)mSyphon stop]; |
| 12 |
[(SyphonServer *)mSyphon release]; |
| 13 |
|
| 14 |
[pool drain]; |
| 15 |
} |
| 16 |
|
| 17 |
void UiRenderSyphon::openPort() { |
| 18 |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; |
| 19 |
|
| 20 |
if(!mSyphon) |
| 21 |
mSyphon = [[SyphonServer alloc] initWithName:nil context:CGLGetCurrentContext() options:nil]; |
| 22 |
|
| 23 |
[pool drain]; |
| 24 |
} |
| 25 |
|
| 26 |
void UiRenderSyphon::publishTexture(int textureTarget, int width, int height) { |
| 27 |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; |
| 28 |
[(SyphonServer *)mSyphon publishFrameTexture:texture textureTarget:textureTarget imageRegion:NSMakeRect(0, 0, width, height) textureDimensions:NSMakeSize(width, height) flipped:false]; |
| 29 |
[pool drain]; |
| 30 |
} |
| 31 |
|