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

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychDemos/OpenGL4MatlabDemos/SpinningCubeDemo.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:
61
61
% 21-Jan-2006 -- Modified for use with OpenGL-Psychtoolbox (MK)
62
62
% 16-Feb-2006 -- Modified for use with new MOGL (MK)
63
63
% 05-Mar-2006 -- Cleaned up for public consumption (MK)
 
64
% 06-Apr-2013 -- Make compatible with OpenGL-ES1.1. (MK)
64
65
 
65
66
% Is the script running in OpenGL Psychtoolbox?
66
67
AssertOpenGL;
182
183
 
183
184
    % Setup cubes rotation around axis:
184
185
    glPushMatrix;
185
 
    glRotated(theta,rotatev(1),rotatev(2),rotatev(3));
 
186
    glRotatef(theta,rotatev(1),rotatev(2),rotatev(3));
186
187
 
187
188
    % Clear out the backbuffer: This also cleans the depth-buffer for
188
189
    % proper occlusion handling:
242
243
 
243
244
% Bind (Select) texture 'tx' for drawing:
244
245
glBindTexture(GL.TEXTURE_2D,tx);
245
 
% Begin drawing of a new polygon:
246
 
glBegin(GL.POLYGON);
 
246
 
 
247
% Begin drawing of a new quad:
 
248
glBegin(GL.QUADS);
247
249
 
248
250
% Assign n as normal vector for this polygons surface normal:
249
 
glNormal3dv(n);
 
251
glNormal3f(n(1), n(2), n(3));
250
252
 
251
253
% Define vertex 1 by assigning a texture coordinate and a 3D position:
252
 
glTexCoord2dv([ 0 0 ]);
253
 
glVertex3dv(v(:,i(1)));
 
254
glTexCoord2f(0, 0);
 
255
glVertex3f(v(1,i(1)),v(2,i(1)),v(3,i(1)));
254
256
% Define vertex 2 by assigning a texture coordinate and a 3D position:
255
 
glTexCoord2dv([ 1 0 ]);
256
 
glVertex3dv(v(:,i(2)));
 
257
glTexCoord2f(1, 0);
 
258
glVertex3f(v(1,i(2)),v(2,i(2)),v(3,i(2)));
257
259
% Define vertex 3 by assigning a texture coordinate and a 3D position:
258
 
glTexCoord2dv([ 1 1 ]);
259
 
glVertex3dv(v(:,i(3)));
 
260
glTexCoord2f(1, 1);
 
261
glVertex3f(v(1,i(3)),v(2,i(3)),v(3,i(3)));
260
262
% Define vertex 4 by assigning a texture coordinate and a 3D position:
261
 
glTexCoord2dv([ 0 1 ]);
262
 
glVertex3dv(v(:,i(4)));
 
263
glTexCoord2f(0, 1);
 
264
glVertex3f(v(1,i(4)),v(2,i(4)),v(3,i(4)));
263
265
% Done with this polygon:
264
266
glEnd;
265
267