List of usage examples for org.lwjgl.opengl GL11 glLoadIdentity
public static native void glLoadIdentity();
From source file:org.joge.core.draw.Graphics.java
License:Open Source License
public void drawImage(Image img, float xpos, float ypos, boolean stopAktion) { img.draw(xpos, ypos);//from www .j ava2 s .c om if (stopAktion) { GL11.glLoadIdentity(); } }
From source file:org.joge.core.draw.Image.java
License:Open Source License
private void drawGL(float xpos, float ypos) { drawWithOutLoadIdentity(xpos, ypos); GL11.glLoadIdentity(); }
From source file:org.jtrfp.mtmx.tools.internal.ModelViewerConfiguration.java
License:Open Source License
@Override public void draw() { GL11.glClearColor(0.8f, 0.8f, 0.8f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity(); GLU.gluLookAt(5.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot2, 1.0f, 0.0f, 0.0f); drawer.draw();/*w w w . j a va 2s . c o m*/ Keyboard.poll(); while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { rot -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { rot += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_UP) { rot2 -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_DOWN) { rot2 += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_T) { if (renderMode == GL11.GL_POLYGON) { renderMode = GL11.GL_LINE_LOOP; } else { renderMode = GL11.GL_POLYGON; } } } } }
From source file:org.jtrfp.mtmx.tools.internal.ModelViewerConfiguration.java
License:Open Source License
@Override public void initView() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 40.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); //GL11.glClearDepth(0.5f); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from w w w .j a va 2s .c om*/ GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.jtrfp.mtmx.tools.internal.TruckViewerConfiguration.java
License:Open Source License
@Override public void draw() { GL11.glClearColor(0.8f, 0.8f, 0.8f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity(); GLU.gluLookAt(5.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot2, 1.0f, 0.0f, 0.0f); truckDrawer.draw();// w ww .j a va 2 s . c om Keyboard.poll(); while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { rot -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { rot += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_UP) { rot2 -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_DOWN) { rot2 += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_A) { truckDrawer.setSteerAngle(truckDrawer.getSteerAngle() + 0.1f); } if (Keyboard.getEventKey() == Keyboard.KEY_D) { truckDrawer.setSteerAngle(truckDrawer.getSteerAngle() - 0.1f); } if (Keyboard.getEventKey() == Keyboard.KEY_T) { if (truckDrawer.getRenderMode() == GL11.GL_POLYGON) { truckDrawer.setRenderMode(GL11.GL_LINE_LOOP); } else { truckDrawer.setRenderMode(GL11.GL_POLYGON); } } } } }
From source file:org.jtrfp.mtmx.tools.internal.TruckViewerConfiguration.java
License:Open Source License
@Override public void initView() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 25.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); //GL11.glClearDepth(0.5f); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from w w w. ja va 2 s . c o m*/ GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.jtrfp.mtmx.tools.internal.WorldViewerConfiguration.java
License:Open Source License
@Override public void draw() { GL11.glClearColor(0.8f, 0.8f, 0.8f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity(); float e = terrainDrawer.getTerrainMap().getElevationAt(1, 1) * IDrawer.WORLD_SCALE_XZ; GLU.gluLookAt(-1.0f + lookX * IDrawer.WORLD_SCALE_XZ, 1.0f + e, -1.0f + lookZ * IDrawer.WORLD_SCALE_XZ, 0.0f + lookX * IDrawer.WORLD_SCALE_XZ, 0.0f + e, 0.0f + lookZ * IDrawer.WORLD_SCALE_XZ, 0.0f, 1.0f, 0.0f);//w w w . j a v a 2 s. c om GL11.glColor3f(0.0f, 1.0f, 0.0f); terrainDrawer.draw(); Keyboard.poll(); while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { lookX -= 5; } if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { lookX += 5; } if (Keyboard.getEventKey() == Keyboard.KEY_UP) { lookZ += 5; } if (Keyboard.getEventKey() == Keyboard.KEY_DOWN) { lookZ -= 5; } if (Keyboard.getEventKey() == Keyboard.KEY_T) { if (terrainDrawer.getRenderMode() == GL11.GL_TRIANGLES) { terrainDrawer.setRenderMode(GL11.GL_LINE_LOOP); } else { terrainDrawer.setRenderMode(GL11.GL_TRIANGLES); } } } } }
From source file:org.jtrfp.mtmx.tools.internal.WorldViewerConfiguration.java
License:Open Source License
@Override public void initView() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0f, 150 * IDrawer.WORLD_SCALE_XZ); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_DEPTH_TEST);//from w w w. j av a 2 s. c o m GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.lwjgl.info.LWJGLTestView.java
License:Open Source License
/** * {@inheritDoc}/*from ww w . j ava 2 s .c o m*/ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ @Override public void createPartControl(Composite parent) { String strVersion = getFeatureVersion("org.lwjgl"); this.setPartName("org.lwjgl " + strVersion); IStatusLineManager statusLine = this.getViewSite().getActionBars().getStatusLineManager(); fpsstatuslineitem = new FpsStatusLineItem(); statusLine.add(fpsstatuslineitem); GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(parent, SWT.NONE, data); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } canvas.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glViewport(0, 0, bounds.width, bounds.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); } }); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); Display.getCurrent().asyncExec(initRunnable()); }
From source file:org.lwjgl.info.LWJGLTestView.java
License:Open Source License
Runnable initRunnable() { return new Runnable() { int rot = 0; public void run() { if (!canvas.isDisposed() && canvas.isVisible()) { fpsstatuslineitem.renderPassStarted(); canvas.setCurrent();//from w w w . jav a 2 s . c o m try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(.2f, .7f, .2f, 1.0f); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); rot++; GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); GL11.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); canvas.swapBuffers(); fpsstatuslineitem.renderPassFinished(); Display.getCurrent().asyncExec(this); } } }; }