29package com.jogamp.opengl.test.junit.jogl.acore;
31import java.awt.Component;
32import java.awt.Dimension;
33import java.awt.event.WindowAdapter;
34import java.awt.event.WindowEvent;
35import java.io.IOException;
36import java.lang.reflect.InvocationTargetException;
37import java.nio.FloatBuffer;
38import java.nio.IntBuffer;
39import java.util.HashSet;
41import java.util.concurrent.Semaphore;
42import java.util.concurrent.TimeUnit;
44import com.jogamp.opengl.GL;
45import com.jogamp.opengl.GL2;
46import com.jogamp.opengl.GLAutoDrawable;
47import com.jogamp.opengl.GLCapabilities;
48import com.jogamp.opengl.GLEventListener;
49import com.jogamp.opengl.GLProfile;
50import com.jogamp.opengl.awt.GLCanvas;
51import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
52import com.jogamp.opengl.fixedfunc.GLPointerFunc;
53import com.jogamp.opengl.glu.GLU;
54import javax.swing.Box;
55import javax.swing.BoxLayout;
56import javax.swing.JFrame;
57import javax.swing.JLabel;
58import javax.swing.JPanel;
59import javax.swing.JSlider;
60import javax.swing.SwingConstants;
61import javax.swing.SwingUtilities;
62import javax.swing.event.ChangeEvent;
63import javax.swing.event.ChangeListener;
65import org.junit.Assert;
66import org.junit.BeforeClass;
68import org.junit.FixMethodOrder;
69import org.junit.runners.MethodSorters;
71import com.jogamp.common.ExceptionUtils;
72import com.jogamp.common.nio.Buffers;
73import com.jogamp.newt.awt.NewtCanvasAWT;
74import com.jogamp.newt.opengl.GLWindow;
75import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
76import com.jogamp.opengl.test.junit.util.TestUtil;
77import com.jogamp.opengl.test.junit.util.UITestCase;
78import com.jogamp.opengl.util.Animator;
91@FixMethodOrder(MethodSorters.NAME_ASCENDING)
94 static long durationPerTest = 1000;
98 private static Semaphore disposalCompleteSemaphore =
new Semaphore(0);
103 setTestSupported(
false);
112 private static final float boundsRadius = 2f;
113 private float viewDistance;
114 private static float viewDistanceFactor = 1.0f;
115 private float xAxisRotation;
116 private float yAxisRotation;
117 private static final float viewFovDegrees = 15f;
122 private final int [] privateVertexBufferObjects = {0};
123 private final int [] privateIndexBufferObjects = {0};
125 public static int createVertexBuffer(
final GL2 gl2) {
126 final FloatBuffer vertexBuffer = Buffers.newDirectFloatBuffer(18);
127 vertexBuffer.put(
new float[]{
135 vertexBuffer.position(0);
137 final int[] vbo = { 0 };
144 public static int createVertexIndexBuffer(
final GL2 gl2) {
145 final IntBuffer indexBuffer = Buffers.newDirectIntBuffer(3);
146 indexBuffer.put(
new int[]{0, 1, 2});
147 indexBuffer.position(0);
149 final int[] vbo = { 0 };
150 gl2.glGenBuffers(1, vbo, 0);
151 gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, vbo[0]);
152 gl2.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.capacity() * Buffers.SIZEOF_INT, indexBuffer, GL.GL_STATIC_DRAW);
153 gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
157 TwoTriangles (
final int canvasWidth,
final int canvasHeight) {
159 this.canvasWidth = canvasWidth;
160 this.canvasHeight = canvasHeight;
163 public void setXAxisRotation(
final float xRot) {
164 xAxisRotation = xRot;
167 public void setYAxisRotation(
final float yRot) {
168 yAxisRotation = yRot;
171 public void setViewDistanceFactor(
final float factor) {
172 viewDistanceFactor = factor;
177 public void init(
final GLAutoDrawable drawable) {
178 final GL2 gl2 = drawable.getGL().getGL2();
180 System.err.println(
"INIT GL IS: " + gl2.getClass().getName());
183 gl2.setSwapInterval(0);
186 gl2.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
190 synchronized (
this) {
192 System.err.println(
"Using local VBOs on slave 0x"+Integer.toHexString(hashCode()));
193 final int [] vertexBufferObjects = privateVertexBufferObjects;
194 final int [] indexBufferObjects = privateIndexBufferObjects;
196 System.err.println(
"Creating vertex VBO on slave 0x"+Integer.toHexString(hashCode()));
197 vertexBufferObjects[0] = createVertexBuffer(gl2);
205 if (gl2.glIsBuffer(vertexBufferObjects[0])) {
206 gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexBufferObjects[0]);
208 gl2.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
209 gl2.glVertexPointer(3, GL.GL_FLOAT, 6 * Buffers.SIZEOF_FLOAT, 0);
211 gl2.glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
212 gl2.glNormalPointer(GL.GL_FLOAT, 6 * Buffers.SIZEOF_FLOAT, 3 * Buffers.SIZEOF_FLOAT);
214 System.err.println(
"Vertex VBO is not a buffer on slave 0x"+Integer.toHexString(hashCode()));
217 System.err.println(
"Creating index VBO on slave 0x"+Integer.toHexString(hashCode()));
218 indexBufferObjects[0] = createVertexIndexBuffer(gl2);
221 if (gl2.glIsBuffer(indexBufferObjects[0])) {
222 gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]);
224 System.err.println(
"Index VBO is not a buffer on slave 0x"+Integer.toHexString(hashCode()));
227 gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
228 gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
229 gl2.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
230 gl2.glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
235 public void dispose(
final GLAutoDrawable drawable) {
237 synchronized (
this) {
238 final GL2 gl2 = drawable.getGL().getGL2();
243 int [] vertexBufferObjects;
244 int [] indexBufferObjects;
245 vertexBufferObjects = privateVertexBufferObjects;
246 indexBufferObjects = privateIndexBufferObjects;
248 gl2.glDeleteBuffers(1, vertexBufferObjects, 0);
249 logAnyErrorCodes(
this, gl2,
"dispose.2");
250 gl2.glDeleteBuffers(1, indexBufferObjects, 0);
251 logAnyErrorCodes(
this, gl2,
"dispose.3");
252 vertexBufferObjects[0] = 0;
253 indexBufferObjects[0] = 0;
257 disposalCompleteSemaphore.release();
262 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {
263 System.err.println(
"reshape: "+canvasWidth+
"x"+canvasHeight+
" -> "+width+
"x"+height+
", [drawable pixel "+drawable.getSurfaceWidth()+
"x"+drawable.getSurfaceHeight()+
"]");
265 canvasHeight = height;
266 final GL2 gl2 = drawable.getGL().getGL2();
267 viewDistance = setupViewFrustum(gl2, canvasWidth, canvasHeight, boundsRadius, 1.0f, viewFovDegrees);
271 public void display(
final GLAutoDrawable drawable) {
272 final GL2 gl2 = drawable.getGL().getGL2();
273 final GLU glu =
new GLU();
275 logAnyErrorCodes(
this, gl2,
"display.0");
278 gl2.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
280 gl2.glViewport(0, 0, canvasWidth, canvasHeight);
281 gl2.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
282 gl2.glLoadIdentity();
283 glu.gluPerspective(viewFovDegrees, (
float)canvasWidth/(
float)canvasHeight,
284 viewDistance*viewDistanceFactor-boundsRadius, viewDistance*viewDistanceFactor+boundsRadius);
287 gl2.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
288 gl2.glLoadIdentity();
291 gl2.glPushAttrib(GL2.GL_ALL_ATTRIB_BITS);
294 glu.gluLookAt(0, 0, 0 + viewDistance*viewDistanceFactor, 0, 0, 0, 0, 1, 0);
295 gl2.glRotatef(xAxisRotation, 1, 0, 0);
296 gl2.glRotatef(yAxisRotation, 0, 1, 0);
298 gl2.glDisable(GL.GL_CULL_FACE);
299 gl2.glEnable(GL.GL_DEPTH_TEST);
301 logAnyErrorCodes(
this, gl2,
"display.1");
304 drawTwoTriangles(gl2);
312 logAnyErrorCodes(
this, gl2,
"display.X");
315 public void drawTwoTriangles(
final GL2 gl2) {
318 gl2.glColor3f(1f, 0f, 0f);
319 gl2.glBegin(GL.GL_TRIANGLES);
320 gl2.glVertex3d(-1.5, -0.5, 0);
321 gl2.glNormal3d(0, 0, 1);
322 gl2.glVertex3d(-0.5, -0.5, 0);
323 gl2.glNormal3d(0, 0, 1);
324 gl2.glVertex3d(-0.75, 0.5, 0);
325 gl2.glNormal3d(0, 0, 1);
328 logAnyErrorCodes(
this, gl2,
"drawTwoTriangles.1");
335 boolean vboBound =
false;
337 int [] vertexBufferObjects;
338 int [] indexBufferObjects;
339 synchronized (
this) {
340 vertexBufferObjects = privateVertexBufferObjects;
341 indexBufferObjects = privateIndexBufferObjects;
350 final boolean isVBO1 = gl2.glIsBuffer(indexBufferObjects[0]);
351 final boolean isVBO2 = gl2.glIsBuffer(vertexBufferObjects[0]);
352 final boolean useVBO = isVBO1 && isVBO2;
354 gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexBufferObjects[0]);
355 gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]);
357 gl2.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
359 gl2.glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
365 logAnyErrorCodes(
this, gl2,
"drawTwoTriangles.2");
368 gl2.glColor3f(0f, 0f, 1f);
369 gl2.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_INT, 0);
370 gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
371 gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
372 gl2.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
373 gl2.glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
376 logAnyErrorCodes(
this, gl2,
"drawTwoTriangles.3");
379 public void displayChanged(
final GLAutoDrawable drawable,
final boolean modeChanged,
final boolean deviceChanged) {
384 private static final Set<String> errorSet =
new HashSet<String>();
389 final String errStr =
"GL-Error: "+prefix +
" on obj 0x"+Integer.toHexString(obj.hashCode())+
", OpenGL error: 0x" + Integer.toHexString(glError);
390 if( errorSet.add(errStr) ) {
391 System.err.println(errStr);
392 ExceptionUtils.dumpStack(System.err);
397 final String errStr =
"GL-Error: "+prefix +
" on obj 0x"+Integer.toHexString(obj.hashCode())+
", glCheckFramebufferStatus: 0x" + Integer.toHexString(status);
398 if( errorSet.add(errStr) ) {
399 System.err.println(errStr);
400 ExceptionUtils.dumpStack(System.err);
423 public static float setupViewFrustum(
final GL2 gl2,
final int width,
final int height,
final float boundsRadius,
final float zoomFactor,
final float viewFovDegrees) {
424 assert boundsRadius > 0.0f;
425 assert zoomFactor > 0.0f;
426 assert viewFovDegrees > 0.0f;
428 final GLU glu =
new GLU();
430 final float aspectRatio = (float) width / (
float) height;
431 final float boundRadiusAdjusted = boundsRadius / zoomFactor;
432 final float lowestFov = aspectRatio > 1.0f ? viewFovDegrees : aspectRatio * viewFovDegrees;
433 final float viewDist = (float) (boundRadiusAdjusted / Math.sin( (lowestFov / 2.0) * (Math.PI / 180.0) ));
437 glu.
gluPerspective(viewFovDegrees, aspectRatio, 0.1*viewDist, viewDist + boundRadiusAdjusted);
444 testCreateVisibleDestroy(
false);
449 testCreateVisibleDestroy(
true);
457 final JFrame frame =
new JFrame(
"JSlider with "+(useNewt?
"NEWT":
"AWT")+
"-OpenGL Widget");
468 final TwoTriangles eventListener1 =
new TwoTriangles(480, 480);
470 final Component openGLComponent1;
476 newtCanvasAWT1.setPreferredSize(
new Dimension(eventListener1.canvasWidth, eventListener1.canvasHeight));
479 openGLComponent1 = newtCanvasAWT1;
480 openGLAutoDrawable1 = glWindow1;
487 canvas1 =
new GLCanvas(glCapabilities);
488 canvas1.
setSize(eventListener1.canvasWidth, eventListener1.canvasHeight);
491 openGLComponent1 = canvas1;
492 openGLAutoDrawable1 = canvas1;
497 final JSlider xAxisRotationSlider =
new JSlider(SwingConstants.VERTICAL, -180, 180, 1);
498 xAxisRotationSlider.setPaintTicks(
false);
499 xAxisRotationSlider.setPaintLabels(
false);
500 xAxisRotationSlider.setSnapToTicks(
false);
501 xAxisRotationSlider.addChangeListener(
new ChangeListener() {
504 public void stateChanged(
final ChangeEvent e) {
505 eventListener1.setXAxisRotation(xAxisRotationSlider.getValue());
508 final JLabel xAxisRotationLabel =
new JLabel(
"X-Axis Rotation");
512 final JSlider yAxisRotationSlider =
new JSlider(SwingConstants.HORIZONTAL, -180, 180, 1);
513 yAxisRotationSlider.setPaintTicks(
false);
514 yAxisRotationSlider.setPaintLabels(
false);
515 yAxisRotationSlider.setSnapToTicks(
false);
516 yAxisRotationSlider.addChangeListener(
new ChangeListener() {
519 public void stateChanged(
final ChangeEvent e) {
520 eventListener1.setYAxisRotation(yAxisRotationSlider.getValue());
523 final JLabel yAxisRotationLabel =
new JLabel(
"Y-Axis Rotation");
528 final JSlider viewDistanceFactorSlider =
new JSlider(SwingConstants.HORIZONTAL, 0, 100, 10);
529 viewDistanceFactorSlider.setPaintTicks(
false);
530 viewDistanceFactorSlider.setPaintLabels(
false);
531 viewDistanceFactorSlider.setSnapToTicks(
false);
532 viewDistanceFactorSlider.addChangeListener(
new ChangeListener() {
535 public void stateChanged(
final ChangeEvent e) {
536 eventListener1.setViewDistanceFactor(viewDistanceFactorSlider.getValue() / 10.0f);
539 final JLabel viewDistanceFactorLabel =
new JLabel(
"View Distance Factor");
542 final JPanel viewDistancePanel =
new JPanel();
543 viewDistancePanel.setLayout(
new BoxLayout(viewDistancePanel, BoxLayout.PAGE_AXIS));
544 viewDistancePanel.add(Box.createVerticalGlue());
545 viewDistancePanel.add(viewDistanceFactorSlider);
546 viewDistancePanel.add(viewDistanceFactorLabel);
547 viewDistancePanel.add(Box.createVerticalGlue());
550 final JPanel openGLPanel =
new JPanel();
551 openGLPanel.setLayout(
new BoxLayout(openGLPanel, BoxLayout.LINE_AXIS));
552 openGLPanel.add(openGLComponent1);
553 openGLPanel.add(Box.createHorizontalStrut(5));
556 final JPanel canvasAndYAxisPanel =
new JPanel();
557 canvasAndYAxisPanel.setLayout(
new BoxLayout(canvasAndYAxisPanel, BoxLayout.PAGE_AXIS));
558 canvasAndYAxisPanel.add(openGLPanel);
559 canvasAndYAxisPanel.add(Box.createVerticalGlue());
560 canvasAndYAxisPanel.add(yAxisRotationSlider);
561 canvasAndYAxisPanel.add(yAxisRotationLabel);
564 final JPanel xAxisPanel =
new JPanel();
565 xAxisPanel.setLayout(
new BoxLayout(xAxisPanel, BoxLayout.LINE_AXIS));
566 xAxisPanel.add(xAxisRotationSlider);
567 xAxisPanel.add(xAxisRotationLabel);
569 final JPanel mainPanel = (JPanel) frame.getContentPane();
570 mainPanel.setLayout(
new BoxLayout(mainPanel, BoxLayout.LINE_AXIS));
571 mainPanel.add(viewDistancePanel);
572 mainPanel.add(Box.createHorizontalGlue());
573 mainPanel.add(canvasAndYAxisPanel);
574 mainPanel.add(Box.createHorizontalGlue());
575 mainPanel.add(xAxisPanel);
577 final Animator animator =
new Animator(Thread.currentThread().getThreadGroup());
579 animator.
add(openGLAutoDrawable1);
581 final Semaphore windowOpenSemaphore =
new Semaphore(0);
582 final Semaphore closingSemaphore =
new Semaphore(0);
589 closingSemaphore.release();
594 SwingUtilities.invokeLater(
new Runnable() {
598 frame.setVisible(
true);
599 windowOpenSemaphore.release();
605 final boolean windowOpened = windowOpenSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS);
606 Assert.assertEquals(
true, windowOpened);
607 }
catch (
final InterruptedException e) {
608 System.err.println(
"Closing wait interrupted: " + e.getMessage());
618 final boolean windowClosed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS);
619 Assert.assertEquals(
true, windowClosed);
620 }
catch (
final InterruptedException e) {
621 System.err.println(
"Closing wait interrupted: " + e.getMessage());
627 SwingUtilities.invokeLater(
new Runnable() {
630 frame.setVisible(
false);
635 closingSemaphore.release();
642 final boolean windowsDisposed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS);
643 Assert.assertEquals(
true, windowsDisposed);
644 }
catch (
final InterruptedException e) {
645 System.err.println(
"Closing wait interrupted: " + e.getMessage());
649 int disposalSuccesses = 0;
652 acquired = disposalCompleteSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS);
656 }
catch (
final InterruptedException e) {
657 System.err.println(
"Clean exit interrupted: " + e.getMessage());
660 Assert.assertEquals(
true, disposalSuccesses == 1);
663 static int atoi(
final String a) {
666 i = Integer.parseInt(a);
667 }
catch (
final Exception ex) { ex.printStackTrace(); }
671 public static void main(
final String[] args)
throws IOException {
672 for(
int i=0; i<args.length; i++) {
673 if(args[i].equals(
"-time")) {
674 if (++i < args.length) {
675 durationPerTest = atoi(args[i]);
AWT Canvas containing a NEWT Window using native parenting.
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
void setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
void setSampleBuffers(final boolean enable)
Defaults to false.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final String GL2
The desktop OpenGL profile 1.x up to 3.0.
A heavyweight AWT component which provides OpenGL rendering support.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Provides access to the OpenGL Utility Library (GLU).
void gluPerspective(float fovy, float aspect, float zNear, float zFar)
TestSingleGLInJSliderNewtAWT.
static float setupViewFrustum(final GL2 gl2, final int width, final int height, final float boundsRadius, final float zoomFactor, final float viewFovDegrees)
Sets the OpenGL projection matrix and front and back clipping planes for a viewport and returns the d...
void test01UseAWTNotShared()
void test10UseNEWTNotShared()
static void main(final String[] args)
static void logAnyErrorCodes(final Object obj, final GL gl, final String prefix)
void testCreateVisibleDestroy(final boolean useNewt)
Assemble the user interface and start the animator.
static TestUtil.WindowClosingListener addClosingListener(final java.awt.Window win)
static boolean closeWindow(final java.awt.Window win, final boolean willClose, final TestUtil.WindowClosingListener closingListener, final Runnable waitAction)
Programmatically issue windowClosing on AWT or NEWT.
final long getTotalFPSDuration()
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
void glGenBuffers(int n, IntBuffer buffers)
Entry point to C language function: void {@native glGenBuffers}(GLsizei n, GLuint * buffers) Part ...
static final int GL_STATIC_DRAW
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_STATI...
int glCheckFramebufferStatus(int target)
Entry point to C language function: GLenum {@native glCheckFramebufferStatus}(GLenum target) Part ...
static final int GL_NO_ERROR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NO_ERROR" with expres...
int glGetError()
Entry point to C language function: GLenum {@native glGetError}() Part of GL_ES_VERSION_2_0,...
static final int GL_FRAMEBUFFER_COMPLETE
GL_ES_VERSION_2_0, GL_ARB_framebuffer_object, GL_VERSION_3_0, GL_EXT_framebuffer_object,...
void glBindBuffer(int target, int buffer)
Entry point to C language function: void {@native glBindBuffer}(GLenum target, GLuint buffer) Part...
static final int GL_FRAMEBUFFER
GL_ES_VERSION_2_0, GL_ARB_framebuffer_object, GL_VERSION_3_0, GL_OES_framebuffer_object,...
void glBufferData(int target, long size, Buffer data, int usage)
Entry point to C language function: void {@native glBufferData}(GLenum target, GLsizeiptr size,...
static final int GL_ARRAY_BUFFER
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_ARRAY...
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
void glLoadIdentity()
Load the current matrix with the identity matrix.
void glMatrixMode(int mode)
Sets the current matrix mode.