File: moglmalloc.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (27 lines) | stat: -rw-r--r-- 969 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function ptr = moglmalloc(nrbytes)
% ptr = moglmalloc(nrbytes) -- Allocate a memory buffer inside mogl.
% This function allocates an internal memory buffer inside mogl for use
% with OpenGL functions that use buffers for passing data forth and back
% between Matlab and OpenGL, e.g., glFeedbackBuffer() or glSelectBuffer().
%
% nrbytes = The number of bytes to allocate.
%
% On successfull allocation, ptr will be a handle for the memory buffer.
% You can think of ptr as a memory pointer in the C-language.
%
% moglmalloc()'ed memory buffers can be released - one by one - via
% moglfree(ptr), all at once via moglfreeall, and they are automatically
% released when moglcore is clear'ed via clear moglcore, clear mex or
% clear all.
%

% 16.05.2006 Written (MK)

% ---protected---

if nargin < 1 || isempty(nrbytes) || nrbytes <1
   error('moglmalloc: Invalid or missing nrbytes size value for requested buffer.');
end;

ptr = moglcore('moglmalloc', nrbytes);
return;