File: glMultiDrawElements.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 (34 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (6)
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
28
29
30
31
32
33
34
function glMultiDrawElements( mode, count, type, indices, drawcount)

% glMultiDrawElements  Interface to OpenGL function glMultiDrawElements
%
% usage:  glMultiDrawElements( mode, count, type, indices, drawcount)
%
% Note: indices must be a cell array whose cells contain uint32() type
% vectors with the indices!
%
% C function:  void glMultiDrawElements(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei drawcount)

% 1-Sep-2012 -- created (generated manually)

% ---protected---

if nargin~=5,
    error('invalid number of arguments');
end

% Ok, the moglcore() implementation doesn't work due to the double-indirect
% pointer, indices[] being an array of pointers to actual separate arrays
% of indices -- Difficult to handle / to pass from Matlab API to C API.
%
% Instead, we reimplement the behaviour of the function by iterative use of
% glDrawElements(), following the specification from the official
% spec of glMultiDrawElements(), which says exactly how to do
% this / defines the function in terms of iterating:
for i = 1:drawcount
    if count(i) > 0
        glDrawElements(mode, count(i), type, uint32(indices{i}));
    end
end

return