List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.freyja.FES.client.models.ModelReceptacle.java
License:LGPL
public void render(RoutingEntity te, double x, double y, double z) { GL11.glPushMatrix();//from ww w.j a v a2 s. c o m GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); ForgeDirection orientation = te.getOrientation(); if (orientation == ForgeDirection.DOWN) { GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -1f, 0f); } if (orientation == ForgeDirection.SOUTH) { GL11.glRotatef(90, 1, 0, 0); GL11.glTranslatef(0, -.5f, -.5f); } if (orientation == ForgeDirection.NORTH) { GL11.glRotatef(90, -1, 0, 0); GL11.glTranslatef(0, -.5f, .5f); } if (orientation == ForgeDirection.WEST) { GL11.glRotatef(90, 0, 0, 1); GL11.glTranslatef(.5f, -.5f, 0); } if (orientation == ForgeDirection.EAST) { GL11.glRotatef(90, 0, 0, -1); GL11.glTranslatef(-.5f, -.5f, 0); } GL11.glScalef(0.5f, 0.5f, 0.5f); FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/FES/textures/receptacle.png"); this.render(); GL11.glPopMatrix(); }
From source file:com.freyja.FES.client.renderers.ItemRenderInjector.java
License:LGPL
private void renderInjector(float x, float y, float z, float scale) { GL11.glPushMatrix();//from ww w. j a v a 2 s.c o m GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(x, y, z); GL11.glScalef(scale, scale, scale); GL11.glRotatef(180f, 0f, 1f, 0f); FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/FES/textures/injector.png"); modelInjector.render(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.gameminers.ethereal.architect.ModelCanvas.java
License:Open Source License
@Override protected void paintGL() { try {//from www . j ava 2 s. co m if (getWidth() != current_width || getHeight() != current_height) { current_width = getWidth(); current_height = getHeight(); GL11.glViewport(0, 0, current_width, current_height); } GL11.glClearColor(0.0f, 0.6f, 0.5f, 1.0f); GL11.glClearDepth(1.0); GL11.glColor3f(1, 1, 1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, (float) getWidth() / (float) getHeight(), 0.1f, 1000.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glTranslatef(0, 0, zoom); GL11.glRotatef(angle, 0f, 1f, 0f); GL11.glRotatef(tilt, 1f, 0f, 0f); GL11.glTranslatef(-16, -16, -16); if (lit) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, lightAmbient); } else { GL11.glDisable(GL11.GL_LIGHTING); } if (textured) { GL11.glEnable(GL11.GL_TEXTURE_2D); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); } if (model != null) { if (model.isAmbientOcclusionEnabled()) { GL11.glShadeModel(GL11.GL_SMOOTH); } else { GL11.glShadeModel(GL11.GL_FLAT); } for (ModelElement ele : model.getElements()) { GL11.glPushMatrix(); if (ele.isShade()) { GL11.glEnable(GL11.GL_LIGHTING); } else { GL11.glDisable(GL11.GL_LIGHTING); } float fromX = ele.getFrom()[0]; float fromY = ele.getFrom()[1]; float fromZ = ele.getFrom()[2]; float toX = ele.getTo()[0]; float toY = ele.getTo()[1]; float toZ = ele.getTo()[2]; float fX = (fromX > toX ? fromX : toX); float fY = (fromY > toY ? fromY : toY); float fZ = (fromZ > toZ ? fromZ : toZ); float tX = (fromX > toX ? toX : fromX); float tY = (fromY > toY ? toY : fromY); float tZ = (fromZ > toZ ? toZ : fromZ); GL11.glTranslatef(fX, fY, fZ); float scaleX = tX - fX; float scaleY = tY - fY; float scaleZ = tZ - fZ; GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0, 0, -1f); for (int i = 0; i < vertices.length / 3; i++) { int faceIdx = i / 4; ModelFace face; switch (faceIdx) { case 0: face = ele.getFaces().getNorth(); break; case 1: face = ele.getFaces().getSouth(); break; case 2: face = ele.getFaces().getUp(); break; case 3: face = ele.getFaces().getDown(); break; case 4: face = ele.getFaces().getWest(); break; case 5: face = ele.getFaces().getEast(); break; default: face = null; break; } int idx = i * 3; float vX = vertices[idx] * scaleX; float vY = vertices[idx + 1] * scaleY; float vZ = vertices[idx + 2] * scaleZ; /*float u; float v; GL11.glTexCoord2f(u, v);*/ GL11.glVertex3f(vX, vY, vZ); } GL11.glEnd(); GL11.glPopMatrix(); } } GL11.glPopMatrix(); swapBuffers(); repaint(); } catch (LWJGLException e) { throw new RuntimeException(e); } }
From source file:com.gameminers.mav.personality.poly.PolygonPersonality.java
License:Open Source License
protected void setup() { frameCount++;// ww w . j a va2 s . co m if (RenderState.attention) { angle = Rendering.tend(angle, targetAngle, 8f); } else { angle = (angle + 0.05f) % 360; } if (RenderState.idle) { targetPulse = (float) (Math.sin(frameCount / 30f) + 1) / 2f; } pulse = Rendering.tend(pulse, targetPulse, 2f); innerPulse = Rendering.tend(innerPulse, targetInnerPulse, 2f); GL11.glRotatef(angle, 0f, 0f, 1f); }
From source file:com.hea3ven.pandoraschest.client.model.ModelBaseChest.java
License:Open Source License
public void render(TileEntityBaseChest chest, double x, double y, double z) { GL11.glPushMatrix();/*ww w . java2s.c o m*/ GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f); GL11.glRotatef(-90.0f + chest.getRotation() * -90.0f, 0.0f, 1.0f, 0.0f); chest.getAnimationState().render(); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelBaseChest.java
License:Open Source License
public void renderItem() { GL11.glPushMatrix();/*from w w w . j av a2s .co m*/ GL11.glDisable(GL11.GL_LIGHTING); // GL11.glTranslatef(0.0f, -0.5f, 0.0f); GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); ModColladaModel.getModelManager().getModel(openResourceName).renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelFluorecentSpot.java
License:Open Source License
public void render(TileEntityFluorecentBlock chest, double x, double y, double z) { int meta = chest.getBlockMetadata(); GL11.glPushMatrix();// ww w.ja va2s . c o m GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); if (meta != 0) { GL11.glTranslatef((float) 0.0f, (float) 0.5f, (float) 0.0f); GL11.glRotatef(90.0f * (meta - 1) + 90.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(-90.f, 1.0f, 0.0f, 0.0f); GL11.glTranslatef((float) 0.0f, (float) -0.5f, (float) 0.0f); } // GL11.glTranslated((float) 2.0f*x, (float) 2.0f*y, (float) 2.0f*z); // GL11.glTranslatef((float) 0.5f, (float) 0.0f, (float)0.5f); // this.renderAnimation(chest.getAnimationFrame()); ModColladaModel.getModelManager().getModel(modelResource).renderAll(); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelFluorecentTube.java
License:Open Source License
public void render(TileEntityFluorecentTubeBlock chest, double x, double y, double z) { int meta = chest.getBlockMetadata(); GL11.glPushMatrix();// w ww . j a v a 2 s .c o m GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); if (meta != 0) { GL11.glTranslatef((float) 0.0f + (chest.getXOffset() / 2.0f), (float) 0.5f + (chest.getYOffset() / 2.0f), (float) 0.0f + (chest.getZOffset() / 2.0f)); GL11.glRotatef(90.0f * (meta - 1) + 90.0f + ((chest.getYOffset() == 0) ? 90.0f : 0.0f), 0.0f, 1.0f, 0.0f); if (chest.getYOffset() != 0) GL11.glRotatef(-90.f, 1.0f, 0.0f, 0.0f); else GL11.glRotatef(-90.f, 0.0f, 0.0f, 1.0f); GL11.glTranslatef((float) 0.0f, (float) -0.5f, (float) 0.0f); } else { GL11.glTranslatef(chest.getXOffset() / 2.0f, chest.getYOffset() / 2.0f, chest.getZOffset() / 2.0f); if (chest.getXOffset() != 0) GL11.glRotatef(90.f, 0.0f, 1.0f, 0.0f); } // GL11.glTranslated((float) 2.0f*x, (float) 2.0f*y, (float) 2.0f*z); // GL11.glTranslatef((float) 0.5f, (float) 0.0f, (float)0.5f); // this.renderAnimation(chest.getAnimationFrame()); ModColladaModel.getModelManager().getModel(modelResource).renderAll(); GL11.glPopMatrix(); }
From source file:com.irr310.i3d.scene.element.I3dElement.java
License:Open Source License
/** * Internal public method Mthode principal du rendu d'un lment. Cette * mthode appelle le code de rendu spcifique de l'lment via la mthode * doDisplay si ncessaire./* ww w.ja v a 2 s .c o m*/ * * @param gl * context gl du rendu * @param camera * point de vue */ final public void display(I3dCamera camera) { if (!visible) { return; } if (!inited) { init(); } GL11.glPushMatrix(); if (transformMatrix != null) { GL11.glMultMatrix(transformMatrix); } else { if (rotation.x != 0) { GL11.glRotatef(rotation.x, 1, 0, 0); } if (rotation.y != 0) { GL11.glRotatef(rotation.y, 0, 1, 0); } if (rotation.z != 0) { GL11.glRotatef(rotation.z, 0, 0, 1); } if (position.x != 0 || position.y != 0 || position.z != 0) { GL11.glTranslatef(position.x, position.y, position.z); } } if (scale.x != 1 || scale.y != 1 || scale.z != 1) { GL11.glScalef(scale.x, scale.y, scale.z); } animation.preDisplay(); if (animation.doDisplay()) { if (showShape) { doDisplay(camera); } if (showBoundingBox) { getBoundingBox().display(); } } animation.postDisplay(); GL11.glPopMatrix(); }
From source file:com.irr310.i3d.scene.element.I3dElement.java
License:Open Source License
/** * Internal public method Mthode principal du rendu de selection d'un * lment. Cette mthode appelle le code de rendu de selection spcifique * de l'lment via la mthode doSelect si ncessaire. Les animations * n'entrent pas en jeu dans le rendu de selection. * /* ww w . j a va2 s. co m*/ * @param gl * context gl du rendu de selection * @param camera * point de vue */ final public void select(I3dCamera camera, long parentId) { if (!inited) { init(); } if (!isTangible() || !showShape) { return; } GL11.glPushMatrix(); // TODO: verify this cast. Maybe change id from long to int if (selectable) { GL11.glLoadName((int) id); } if (rotation.x != 0) { GL11.glRotatef(rotation.x, 1, 0, 0); } if (rotation.y != 0) { GL11.glRotatef(rotation.y, 0, 1, 0); } if (rotation.z != 0) { GL11.glRotatef(rotation.z, 0, 0, 1); } if (position.x != 0 || position.y != 0 || position.z != 0) { GL11.glTranslatef(position.x, position.y, position.z); } if (scale.x != 1 || scale.y != 1 || scale.z != 1) { GL11.glScalef(scale.x, scale.y, scale.z); } if (selectable) { doSelect(camera, id); } else { doSelect(camera, parentId); } if (selectable) { GL11.glLoadName((int) parentId); } GL11.glPopMatrix(); }