List of usage examples for org.lwjgl.opengl GL11 GL_MODELVIEW
int GL_MODELVIEW
To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.
Click Source Link
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();/*from w w w .j a va 2s . co m*/ if (numFacets < 1) numFacets = vertBuffer.capacity() / VFP; if (offset != null) GL11.glTranslatef(offset.x, offset.y, offset.z); else 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.Rendering.java
License:Open Source License
public void renderDisplay() { initSettings();// w w w.ja v a2 s .c om final Colour BC = backColour == null ? Colour.DARK_GREY : backColour; GL11.glClearColor(BC.r, BC.g, BC.b, BC.a); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); port.applyView(); lighting.bindLight(0); for (Client client : clients) { GL11.glColor4f(1, 1, 1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); final int disabled[] = client.GL_disables(); if (disabled != null) for (int d : disabled) GL11.glDisable(d); client.renderTo(this); if (disabled != null) for (int d : disabled) GL11.glEnable(d); } clients.clear(); if (HUD != null) { HUD.renderHUD(new Box2D().set(0, 0, viewWide, viewHigh)); } // // TODO: Allow a custom image-tex? final Colour FC = foreColour == null ? Colour.NONE : foreColour; //final Colour FC = Colour.GREY ; FC.bindColour(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBegin(GL11.GL_QUADS); UINode.drawQuad(0, 0, viewWide, viewHigh, 0, 0, 1, 1, 0); GL11.glEnd(); Display.update(); }
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. *///w w w .j a v a 2s . co m 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./*from w w w. j av a2 s . com*/ */ 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 .ja va 2s. c om */ 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.cutout.ImageSprite.java
License:Open Source License
public void renderTo(Rendering rendering) { ////from w w w . ja v a 2 s .co m // 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(); }
From source file:src.graphics.sfx.SFX.java
License:Open Source License
protected void renderTex(Vec3D[] verts, Texture tex) { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();/*w w w. j a v a 2 s . c o m*/ tex.bindTex(); Vec3D v; GL11.glDepthMask(false); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); v = verts[0]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glTexCoord2f(0, 1); v = verts[1]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glTexCoord2f(1, 1); v = verts[2]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glTexCoord2f(1, 0); v = verts[3]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glEnd(); GL11.glDepthMask(true); }
From source file:src.graphics.widgets.HUD.java
License:Open Source License
public void renderHUD(Box2D bounds) { relBound.set(0, 0, 1, 1);//from w ww . j av a2 s .c o m absBound.set(0, 0, 0, 0); updateAsBase(bounds); final UINode oldSelect = selected; if ((selected == null) || (mouseState != DRAGGED)) { selected = selectionAt(mousePos); } if (mouseState != HOVERED) { //hoverStart = System.currentTimeMillis() ; } else if (selected != null && selected != oldSelect) { hoverStart = System.currentTimeMillis(); } if (selected != null) switch (mouseState) { case (HOVERED): selected.whenHovered(); break; case (CLICKED): selected.whenClicked(); break; case (PRESSED): selected.whenPressed(); break; case (DRAGGED): selected.whenDragged(); break; } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, bounds.xdim(), 0, bounds.ydim(), -100, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); super.render(); }
From source file:stevekung.mods.moreplanets.planets.diona.render.entities.RenderDionaCreeperBoss.java
License:Creative Commons License
protected int func_27006_a(EntityDionaCreeperBoss par1EntityCreeper, int par2, float par3) { if (par1EntityCreeper.isArmored()) { if (par2 == 1) { final float f1 = par1EntityCreeper.ticksExisted + par3; this.bindTexture(RenderDionaCreeperBoss.invulnerableCreeperTexture); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity();/*from ww w.j a v a 2 s.c o m*/ final float f2 = f1 * 0.01F; final float f3 = f1 * 0.01F; GL11.glTranslatef(f2, f3, 0.0F); this.setRenderPassModel(this.mainModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (par2 == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } else if (!par1EntityCreeper.isArmored()) { if (par2 == 1) { final float f1 = par1EntityCreeper.ticksExisted + par3; this.bindTexture(RenderDionaCreeperBoss.powerTexture); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); final float f2 = f1 * 0.01F; final float f3 = f1 * 0.01F; GL11.glTranslatef(f2, f3, 0.0F); this.setRenderPassModel(this.mainModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (par2 == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }
From source file:stevekung.mods.moreplanets.planets.diona.render.entities.RenderDionaMinionCreeper.java
License:Creative Commons License
protected int renderCreeperPassModel(EntityDionaMinionCreeper par1EntityCreeper, int par2, float par3) { if (par1EntityCreeper.getPowered()) { if (par1EntityCreeper.isInvisible()) { GL11.glDepthMask(false);/*w w w.j av a2 s . c om*/ } else { GL11.glDepthMask(true); } if (par2 == 1) { float f1 = par1EntityCreeper.ticksExisted + par3; this.bindTexture(RenderDionaMinionCreeper.powerTexture); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float f2 = f1 * 0.01F; float f3 = f1 * 0.01F; GL11.glTranslatef(f2, f3, 0.0F); this.setRenderPassModel(this.creeperModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); float f4 = 0.5F; GL11.glColor4f(f4, f4, f4, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (par2 == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }