1 |
jakw |
1 |
%PROJECTOR Matlab wrapper class for the Projector C++ class.
|
|
|
2 |
% Creates a fullscreen OpenGL context for the screen specified for fast
|
|
|
3 |
% texture or pattern projection.
|
|
|
4 |
%
|
|
|
5 |
% Jakob Wilm, DTU 2013
|
|
|
6 |
|
|
|
7 |
classdef Projector < handle
|
|
|
8 |
properties (SetAccess = private, Hidden = true)
|
|
|
9 |
objectHandle; % Handle to the underlying C++ class instance
|
|
|
10 |
end
|
|
|
11 |
methods (Static = true)
|
|
|
12 |
function varargout = GetScreenInfo
|
|
|
13 |
[varargout{1:nargout}] = ProjectorMex('GetScreenInfo');
|
|
|
14 |
end
|
|
|
15 |
end
|
|
|
16 |
methods
|
|
|
17 |
% Constructor - Create a new C++ class instance
|
|
|
18 |
function this = Projector(screenNum)
|
|
|
19 |
this.objectHandle = ProjectorMex('new', screenNum);
|
|
|
20 |
end
|
|
|
21 |
|
|
|
22 |
% Destructor - Destroy the C++ class instance
|
|
|
23 |
function delete(this)
|
|
|
24 |
ProjectorMex('delete', this.objectHandle);
|
|
|
25 |
end
|
|
|
26 |
|
|
|
27 |
% displayTexture
|
|
|
28 |
function varargout = displayTexture(this, texture)
|
28 |
jakw |
29 |
% check input
|
|
|
30 |
if(size(texture,3) ~= 3 || ~isa(texture, 'uint8'))
|
|
|
31 |
error('Input must be [r x c x 3] of type uint8');
|
|
|
32 |
end
|
1 |
jakw |
33 |
height = size(texture, 1);
|
|
|
34 |
width = size(texture, 2);
|
|
|
35 |
% swivel data to match RMO OpenGL format
|
|
|
36 |
texture = permute(texture, [3 2 1]);
|
255 |
- |
37 |
size(texture)
|
1 |
jakw |
38 |
[varargout{1:nargout}] = ProjectorMex('displayTexture', this.objectHandle, texture, width, height);
|
|
|
39 |
end
|
|
|
40 |
|
|
|
41 |
% displayWhite
|
|
|
42 |
function varargout = displayWhite(this)
|
|
|
43 |
[varargout{1:nargout}] = ProjectorMex('displayWhite', this.objectHandle);
|
|
|
44 |
end
|
|
|
45 |
|
|
|
46 |
% displayBlack
|
|
|
47 |
function varargout = displayBlack(this)
|
|
|
48 |
[varargout{1:nargout}] = ProjectorMex('displayBlack', this.objectHandle);
|
|
|
49 |
end
|
|
|
50 |
|
|
|
51 |
% setGamma
|
|
|
52 |
function varargout = SetGamma(this, gamma)
|
|
|
53 |
[varargout{1:nargout}] = ProjectorMex('SetGamma', this.objectHandle, gamma);
|
|
|
54 |
end
|
|
|
55 |
|
|
|
56 |
end
|
|
|
57 |
end
|