List of usage examples for org.lwjgl.opengl GL11 glPushMatrix
public static native void glPushMatrix();
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void drawPolygon(float x, float y, float radius, float r, float g, float b, float a, int count, float z) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D);//w w w . j a va2s.c o m GL11.glTranslatef(x, y, z); GL11.glColor4f(r, g, b, a); GL11.glBegin(GL11.GL_POLYGON); for (int i = 0; i < count; ++i) { GL11.glVertex2d(Math.sin(i / ((double) count) * 2 * Math.PI) * (radius), Math.cos(i / ((double) count) * 2 * Math.PI) * (radius)); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void drawTriangle(float x, float y, float radius, float r, float g, float b, float a, float z) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D);/*from ww w . j ava 2 s . c om*/ GL11.glTranslatef(x, y, z); GL11.glColor4f(r, g, b, a); GL11.glBegin(GL11.GL_TRIANGLES); for (int i = 0; i < 3; ++i) { GL11.glVertex2d(Math.sin(i / ((double) 3) * 2 * Math.PI) * (radius), Math.cos(i / 3D * 2 * Math.PI) * (radius)); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void drawRectangle(float x, float y, float width, float height, float r, float g, float b, float a, float z) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D);/* ww w .j a v a 2 s .c om*/ GL11.glTranslatef(0, 0, z); GL11.glColor4f(r, g, b, a); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:com.github.begla.blockmania.game.blueprints.BlockGrid.java
License:Apache License
public void render() { glEnable(GL_BLEND);//from ww w . ja v a2s. c o m glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); for (int i = 0; i < 2; i++) { if (i == 0) { glColorMask(false, false, false, false); } else { glColorMask(true, true, true, true); } for (BlockPosition gp : _gridPositions) { GL11.glPushMatrix(); Vector3f r = _parent.getWorldProvider().getRenderingReferencePoint(); GL11.glTranslatef(gp.x - r.x, gp.y - r.y, gp.z - r.z); GL11.glCallList(_blockDisplayList); GL11.glPopMatrix(); } } glDisable(GL11.GL_BLEND); }
From source file:com.github.begla.blockmania.world.chunk.Chunk.java
License:Apache License
/** * Draws the opaque or translucent elements of a chunk. * * @param type The type of vertices to render *///from w w w . j a va2s . c om public void render(ChunkMesh.RENDER_TYPE type) { GL11.glPushMatrix(); GL11.glTranslatef(getPosition().x * getChunkDimensionX() - _parent.getRenderingReferencePoint().x, getPosition().y * getChunkDimensionY() - _parent.getRenderingReferencePoint().y, getPosition().z * getChunkDimensionZ() - _parent.getRenderingReferencePoint().z); // Render the generated chunk mesh if (_activeMesh != null) { _activeMesh.render(type); } GL11.glPopMatrix(); }
From source file:com.github.begla.blockmania.world.physics.BulletPhysicsRenderer.java
License:Apache License
public void render() { for (BlockRigidBody b : _blocks) { Transform t = new Transform(); b.getMotionState().getWorldTransform(t); GL11.glPushMatrix(); FloatBuffer mBuffer = BufferUtils.createFloatBuffer(16); float[] mFloat = new float[16]; t.getOpenGLMatrix(mFloat);/*from ww w .j a va 2 s .c o m*/ mBuffer.put(mFloat); mBuffer.flip(); GL11.glTranslatef(-_parent.getPlayer().getPosition().x, -_parent.getPlayer().getPosition().y, -_parent.getPlayer().getPosition().z); GL11.glMultMatrix(mBuffer); float lightValue = calcLightValueForTransform(t); int lightRef = GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("block"), "light"); GL20.glUniform1f(lightRef, lightValue); BlockManager.getInstance().getBlock(b.getType()).render(); GL11.glPopMatrix(); } }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
/** ************************************************************************* */ public boolean drawImage(Image img, int x, int y, ImageObserver observer) { this.startPainting(); // store the current model matrix GL11.glPushMatrix(); // bind to the appropriate texture for this sprite Texture texture = this.textureLoader.getTexture((BufferedImage) img); texture.bind();/*w w w.j a v a2s . c o m*/ // translate to the right location and prepare to draw GL11.glTranslatef(x, y, 0); // draw a quad textured to match the sprite GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0, texture.getHeight()); GL11.glVertex2f(0, texture.getImageHeight()); GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.glVertex2f(texture.getImageWidth(), texture.getImageHeight()); GL11.glTexCoord2f(texture.getWidth(), 0); GL11.glVertex2f(texture.getImageWidth(), 0); GL11.glEnd(); // restore the model view matrix to prevent contamination GL11.glPopMatrix(); this.endPainting(); return true; }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { this.startPainting(); GL11.glPushMatrix(); Texture texture = this.textureLoader.getTexture((BufferedImage) img); texture.bind();/*from w ww . j a v a 2 s . c o m*/ GL11.glTranslatef(x, y, 0); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0, texture.getHeight()); GL11.glVertex2f(0, height); GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.glVertex2f(width, height); GL11.glTexCoord2f(texture.getWidth(), 0); GL11.glVertex2f(width, 0); GL11.glEnd(); GL11.glPopMatrix(); this.endPainting(); return true; }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
public boolean drawImage(Image img, AffineTransform transform, ImageObserver obs) { transform.getMatrix(LWJGLGraphics.affineMatrix); LWJGLGraphics.glMatrix.rewind();/*w ww. ja va2s. co m*/ LWJGLGraphics.glMatrix.put((float) LWJGLGraphics.affineMatrix[0]).put((float) LWJGLGraphics.affineMatrix[1]) .put(0).put(0); LWJGLGraphics.glMatrix.put((float) LWJGLGraphics.affineMatrix[2]).put((float) LWJGLGraphics.affineMatrix[3]) .put(0).put(0); LWJGLGraphics.glMatrix.put(0).put(0).put(1).put(0); LWJGLGraphics.glMatrix.put((float) LWJGLGraphics.affineMatrix[4]).put((float) LWJGLGraphics.affineMatrix[5]) .put(0).put(1); LWJGLGraphics.glMatrix.rewind(); GL11.glPushMatrix(); GL11.glMultMatrix(LWJGLGraphics.glMatrix); this.drawImage(img, 0, 0, null); GL11.glPopMatrix(); return true; }
From source file:com.hea3ven.colladamodel.client.model.Geometry.java
License:Open Source License
public void render(Tessellator tessellator) { GL11.glPushMatrix(); for (Transform trans : transforms.values()) { trans.apply();/*from www .j a v a 2 s. c o m*/ } for (Face face : faces) { face.render(tessellator); } GL11.glPopMatrix(); }