~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychOpenGL/MOGL/wrap/glMultiDrawElementsBaseVertex.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function glMultiDrawElementsBaseVertex( mode, count, type, indices, drawcount, basevertex )
 
2
 
 
3
% glMultiDrawElementsBaseVertex  Interface to OpenGL function glMultiDrawElementsBaseVertex
 
4
%
 
5
% usage:  glMultiDrawElementsBaseVertex( mode, count, type, indices, drawcount, basevertex )
 
6
%
 
7
% Note: indices must be a cell array whose cells contain uint32() type
 
8
% vectors with the indices!
 
9
%
 
10
% C function:  void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei drawcount, const GLint* basevertex)
 
11
 
 
12
% 30-Aug-2012 -- created (generated automatically from header files)
 
13
 
 
14
% ---protected---
 
15
 
 
16
if nargin~=6,
 
17
    error('invalid number of arguments');
 
18
end
 
19
 
 
20
% Ok, the moglcore() implementation doesn't work due to the double-indirect
 
21
% pointer, indices[] being an array of pointers to actual separate arrays
 
22
% of indices -- Difficult to handle / to pass from Matlab API to C API.
 
23
%
 
24
% Therefore this call is disabled:
 
25
% moglcore( 'glMultiDrawElementsBaseVertex', mode, int32(count), type, const, drawcount, int32(basevertex) );
 
26
 
 
27
% Instead, we reimplement the behaviour of the function by iterative use of
 
28
% glDrawElementsBaseVertex(), following the specification from the official
 
29
% spec of glMultiDrawElementsBaseVertex(), which says exactly how to do
 
30
% this / defines the function in terms of iterating:
 
31
for i = 1:drawcount
 
32
    if count(i) > 0
 
33
        glDrawElementsBaseVertex(mode, count(i), type, uint32(indices{i}), basevertex(i));
 
34
    end
 
35
end
 
36
 
 
37
return