List of usage examples for org.lwjgl.opengl GL11 glLoadIdentity
public static native void glLoadIdentity();
From source file:rtype.Prototyp.java
License:Open Source License
private void renderScanLines() { GL11.glLoadIdentity(); GL11.glTranslatef(0, 0, Prototyp.DEFAULT_Z); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureLoader.getTexture(IEntity.SCANLINE).getTextureId()); GL11.glColor4f(1, 1, 1, 1);// w w w. j a v a 2 s . c o m GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(20, 0); //Upper right GL11.glVertex2f(SCREEN_WIDTH / 4, -SCREEN_HEIGHT / 4); GL11.glTexCoord2f(0, 0); //Upper left GL11.glVertex2f(-SCREEN_WIDTH / 4, -SCREEN_HEIGHT / 4); GL11.glTexCoord2f(0, 20); //Lower left GL11.glVertex2f(-SCREEN_WIDTH / 4, SCREEN_HEIGHT / 4); GL11.glTexCoord2f(20, 20); // Lower right GL11.glVertex2f(SCREEN_WIDTH / 4, SCREEN_HEIGHT / 4); GL11.glEnd(); }
From source file:shadowmage.meim.client.gui.GuiModelEditor.java
License:Open Source License
private void setupModelView() { /**/*from w w w .j av a2 s .c om*/ * load a clean projection matrix */ GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); /** * set up the base projection transformation matrix, as well as view target and position * (camera setup) */ float aspect = (float) this.mc.displayWidth / (float) this.mc.displayHeight; GLU.gluPerspective(60.f, aspect, 0.1f, 100.f); GLU.gluLookAt(viewPosX, viewPosY, viewPosZ, viewTargetX, viewTargetY, viewTargetZ, 0, 1, 0); /** * load a clean model-view matrix */ GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); /** * and finally, clear the depth buffer * (we want to ignore any world/etc, as we're rendering over-top of it all anyway) */ GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); }
From source file:sketchwars.scenes.Camera.java
public void applyCameraSettings() { Vector2d offset = getOffset(); GL11.glLoadIdentity(); GL11.glOrtho(worldLeft, worldRight, worldBottom, worldTop, -1.0, 1.0); GL11.glScalef(worldWidth / width, worldHeight / height, 1); GL11.glTranslatef((float) offset.x, (float) offset.y, 0); }
From source file:spaceshooter.main.SpaceShooter.java
License:Creative Commons License
public void init() { try {/*w w w. ja v a 2 s. c o m*/ Display.setDisplayMode(new DisplayMode(RenderingHelper.xSize, RenderingHelper.ySize)); Display.setTitle("Space Shooter"); Display.sync(60); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, RenderingHelper.xSize, 0, RenderingHelper.ySize, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); while (!Display.isCloseRequested()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); LevelHelper.level.get(level).setup(); LevelHelper.level.get(level).generateLevel(); player.handleInput(); player.draw(); player.onUpdate(); Display.update(); } Display.destroy(); }
From source file:src.graphics.common.MeshBuffer.java
License:Open Source License
public static void render(float scale, float rotation, Vec3D offset, FloatBuffer vertBuffer, FloatBuffer normBuffer, FloatBuffer textBuffer, int numFacets) { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); if (numFacets < 1) numFacets = vertBuffer.capacity() / VFP; if (offset != null) GL11.glTranslatef(offset.x, offset.y, offset.z); else/*w ww. java 2 s . c o m*/ GL11.glTranslatef(0, 0, 0); GL11.glRotatef(rotation, 0, 0, 1); GL11.glScalef(scale, scale, scale); // // Only set the texture buffer if one has been provided: if (textBuffer == null) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); } else { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL11.glTexCoordPointer(2, 0, textBuffer); } // // And only set the normal buffer if one has been provided: if (normBuffer == null) GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); else { GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); GL11.glNormalPointer(0, normBuffer); } // // Bind the vertex buffer and render- GL11.glVertexPointer(3, 0, vertBuffer); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, numFacets * 3); }
From source file:src.graphics.common.Viewport.java
License:Open Source License
/** Used to render 2D image-based sprites, flat mode disables lighting and * face culling and eliminates rotation transforms. *///from ww w.jav a 2s.c om public void setFlatMode() { if (projectMode == MODE_FLAT) return; GL11.glDisable(GL11.GL_CULL_FACE); doOrtho(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); projectMode = MODE_FLAT; }
From source file:src.graphics.common.Viewport.java
License:Open Source License
/** Used to render 3D joint-based sprites, static model sprites, etc- Iso * mode applies isometric view transforms and enables lighting and face * culling.// www . j a v a 2 s .c om */ public void setIsoMode() { if (projectMode == MODE_ISOMETRIC) return; GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); doOrtho(); GL11.glRotatef((float) (0 - cameraElevated * 180 / Math.PI), 1, 0, 0); GL11.glRotatef((float) (0 - cameraRotation * 180 / Math.PI), 0, 0, 1); GL11.glTranslatef(0 - cameraPosition.x, 0 - cameraPosition.y, 0 - cameraPosition.z); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); projectMode = MODE_ISOMETRIC; }
From source file:src.graphics.common.Viewport.java
License:Open Source License
/** Similar to flat mode, but the coordinates used correspond directly with * screen-pixel coordinates./*from w w w .jav a2 s. c o m*/ */ public void setScreenMode() { if (projectMode == MODE_SCREEN) return; GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, viewBounds.xdim(), 0, viewBounds.ydim(), -100 * screenS, 100 * screenS); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); projectMode = MODE_SCREEN; }
From source file:src.graphics.common.Viewport.java
License:Open Source License
/** Sets the OpenGL projection matrix to the correct height and width. *//*from www .ja va 2 s . co m*/ private void doOrtho() { final float wide = viewBounds.xdim() * 0.5f / screenS, high = viewBounds.ydim() * 0.5f / screenS; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0 - wide, wide, 0 - high, high, -100 / cameraZoom, 100 / cameraZoom); }
From source file:src.graphics.cutout.ImageSprite.java
License:Open Source License
public void renderTo(Rendering rendering) { ///*from w w w .j a va 2 s . com*/ // Since we've disabled normal lighting, we have to 'fake it' using colour // parameters: GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); final Colour c = colour == null ? Colour.WHITE : colour; if (c.a < 0) { GL11.glColor4f(c.r, c.g, c.b, 0 - c.a); } else { final Lighting l = rendering.lighting; GL11.glColor4f(c.r * fog * l.r(), c.g * fog * l.g(), c.b * fog * l.b(), c.a); } // // Obtain the correct set of UV coordinates for the current frame- model.texture.bindTex(); final float framesUV[][] = model.framesUV(); final float texUV[] = framesUV[(int) animProgress]; // // TODO: Consider replacing this with an aggregate method within the // MeshBuffer class? Re-implement RenderPass, in other words. GL11.glBegin(GL11.GL_TRIANGLES); int tI = 0; for (Vec3D vert : model.coords) { GL11.glTexCoord2f(texUV[tI++], texUV[tI++]); GL11.glVertex3f(position.x + (vert.x * scale), position.y + (vert.y * scale), position.z + (vert.z * scale)); } GL11.glEnd(); }