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:kuake2.render.lwjgl.Main.java
License:Open Source License
/** * R_PolyBlend/* w w w . jav a 2 s . c om*/ */ void R_PolyBlend() { if (gl_polyblend.value == 0.0f) return; if (v_blend[3] == 0.0f) return; GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLoadIdentity(); // FIXME: get rid of these GL11.glRotatef(-90, 1, 0, 0); // put Z going up GL11.glRotatef(90, 0, 0, 1); // put Z going up GL11.glColor4f(v_blend[0], v_blend[1], v_blend[2], v_blend[3]); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(10, 100, 100); GL11.glVertex3f(10, -100, 100); GL11.glVertex3f(10, -100, -100); GL11.glVertex3f(10, 100, -100); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1, 1, 1, 1); }
From source file:kuake2.render.lwjgl.Main.java
License:Open Source License
/** * R_SetupGL//from w w w .ja va2 s .co m */ void R_SetupGL() { // // set up viewport // //int x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width); int x = r_newrefdef.x; //int x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width); int x2 = r_newrefdef.x + r_newrefdef.width; //int y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height); int y = vid.height - r_newrefdef.y; //int y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height); int y2 = vid.height - (r_newrefdef.y + r_newrefdef.height); int w = x2 - x; int h = y - y2; GL11.glViewport(x, y2, w, h); // // set up projection matrix // float screenaspect = (float) r_newrefdef.width / r_newrefdef.height; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); MYgluPerspective(r_newrefdef.fov_y, screenaspect, 4, 4096); GL11.glCullFace(GL11.GL_FRONT); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glRotatef(-90, 1, 0, 0); // put Z going up GL11.glRotatef(90, 0, 0, 1); // put Z going up GL11.glRotatef(-r_newrefdef.viewangles[2], 1, 0, 0); GL11.glRotatef(-r_newrefdef.viewangles[0], 0, 1, 0); GL11.glRotatef(-r_newrefdef.viewangles[1], 0, 0, 1); GL11.glTranslatef(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, r_world_matrix); r_world_matrix.clear(); // // set drawing parms // if (gl_cull.value != 0.0f) GL11.glEnable(GL11.GL_CULL_FACE); else GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:kuake2.render.lwjgl.Warp.java
License:Open Source License
/** * R_DrawSkyBox//from w w w. java 2 s. c om */ void R_DrawSkyBox() { int i; if (skyrotate != 0) { // check for no sky at all for (i = 0; i < 6; i++) if (skymins[0][i] < skymaxs[0][i] && skymins[1][i] < skymaxs[1][i]) break; if (i == 6) return; // nothing visible } GL11.glPushMatrix(); GL11.glTranslatef(r_origin[0], r_origin[1], r_origin[2]); GL11.glRotatef(r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]); for (i = 0; i < 6; i++) { if (skyrotate != 0) { // hack, forces full sky to draw when rotating skymins[0][i] = -1; skymins[1][i] = -1; skymaxs[0][i] = 1; skymaxs[1][i] = 1; } if (skymins[0][i] >= skymaxs[0][i] || skymins[1][i] >= skymaxs[1][i]) continue; GL_Bind(sky_images[skytexorder[i]].texnum); GL11.glBegin(GL11.GL_QUADS); MakeSkyVec(skymins[0][i], skymins[1][i], i); MakeSkyVec(skymins[0][i], skymaxs[1][i], i); MakeSkyVec(skymaxs[0][i], skymaxs[1][i], i); MakeSkyVec(skymaxs[0][i], skymins[1][i], i); GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:LavaBoat.renderer.RenderLavaBoat.java
License:LGPL
/** * The render method used in RenderBoat that renders the boat model. *//*from w w w .j ava 2 s. com*/ public void renderBoat(EntityNKBoat boat, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(180 - par8, 0, 1, 0); float f2 = boat.getTimeSinceHit() - par9; float f3 = boat.getDamageTaken() - par9; if (f3 < 0) { f3 = 0; } if (f2 > 0) { GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10F * boat.getForwardDirection(), 1, 0, 0); } float f4 = 0.75F; GL11.glScalef(f4, f4, f4); GL11.glScalef(1 / f4, 1 / f4, 1 / f4); getTexture(); GL11.glScalef(-1, -1, 1); if (boatType == 1 || boatType == 3) { GL11.glRotatef(180, 0, 1, 0); } this.modelBoat.render(boat, 0, 0, -0.1F, 0, 0, 0.0625F); GL11.glPopMatrix(); }
From source file:lyonlancer5.pfsteel.client.render.projectile.RenderBullet.java
License:Open Source License
public void renderBullet(EntityBullet entityarrow, double d, double d1, double d2, float f, float f1) { bindEntityTexture(entityarrow);/*ww w .j a v a2 s . co m*/ GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); Tessellator tessellator = Tessellator.instance; float f2 = 0.0F; float f3 = 0.3125F; float f10 = 0.05625F; GL11.glEnable(32826); GL11.glScalef(0.07F, 0.07F, 0.07F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, -1.0D, -1.0D, f2, f2); tessellator.addVertexWithUV(0.0D, -1.0D, 1.0D, f3, f2); tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, f3, f3); tessellator.addVertexWithUV(0.0D, 1.0D, -1.0D, f2, f3); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, 1.0D, -1.0D, f2, f2); tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, f3, f2); tessellator.addVertexWithUV(0.0D, -1.0D, 1.0D, f3, f3); tessellator.addVertexWithUV(0.0D, -1.0D, -1.0D, f2, f3); tessellator.draw(); for (int j = 0; j < 4; j++) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-1.0D, -1.0D, 0.0D, f2, f2); tessellator.addVertexWithUV(1.0D, -1.0D, 0.0D, f3, f2); tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, f3, f3); tessellator.addVertexWithUV(-1.0D, 1.0D, 0.0D, f2, f3); tessellator.draw(); } GL11.glDisable(32826); GL11.glPopMatrix(); }
From source file:lyonlancer5.pfsteel.client.render.projectile.RenderExplosiveArrow.java
License:Open Source License
public void doRender(EntityExplosiveArrow p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { bindEntityTexture(p_76986_1_);/*from w ww . j a v a2 s .c om*/ GL11.glPushMatrix(); GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_); GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = (float) p_76986_1_.arrowShake - p_76986_9_; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:lyonlancer5.pfsteel.client.render.projectile.RenderPortalArrow.java
License:Open Source License
public void doRender(EntityPortalArrow p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { bindEntityTexture(p_76986_1_);// w w w .j av a2 s . c o m GL11.glPushMatrix(); GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_); GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:lyonlancer5.pfsteel.client.render.projectile.RenderRedBullet.java
License:Open Source License
public void doRender(EntityRedBullet p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { bindEntityTexture(p_76986_1_);/*w w w. j a v a 2s .co m*/ GL11.glPushMatrix(); GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_); GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = (float) p_76986_1_.arrowShake - p_76986_9_; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:lyonlancer5.pfsteel.client.render.RenderDarkShield.java
License:Open Source License
protected void renderDarkMain(EntityDarkShield shield, double x, double y, double z, float yaw, float pitch) { GL11.glDisable(GL11.GL_LIGHTING);//from w ww . ja va 2 s . c o m GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); if (RenderManager.instance.getDistanceToCamera(shield.posX, shield.posY, shield.posZ) < 36.0D) { GL11.glDepthFunc(GL11.GL_ALWAYS); } else { GL11.glDepthMask(false); } GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); Tessellator tessellator = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR); GL11.glTranslatef(0.0F, 1.3F, 0.0F); this.bindTexture(darkTex); renderDark(tessellator, 12.0D, 12.0F, 0.0D, 1.0F, 0); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(true); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); }
From source file:lyonlancer5.pfsteel.client.render.RenderMagicCircle.java
License:Open Source License
public void renderSpellCardCircle(EntityMagicCircle circle, double x, double y, double z, float yaw, float pitch) { GL11.glPushMatrix();/*from w w w . jav a2s .co m*/ bindEntityTexture(circle); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR); float size = circle.getCircleSize() * 6.0F; GL11.glScalef(size, size, size); Tessellator tessellator = Tessellator.instance; float umin = 0.0F; float umax = 1.0F; float vmin = 0.0F; float vmax = 1.0F; boolean rainbow = false; int color = circle.getCircleType(); if (color >= 16) { float angle = MathHelper.sin(2F * (float) circle.getAnimationCount() / 180F * (float) Math.PI) * 40F; GL11.glRotatef(180F - renderManager.playerViewY + angle, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewX - angle, 1.0F, 0.0F, 0.0F); GL11.glRotatef(circle.getAnimationCount() * 5F, 0.0F, 0.0F, 1.0F); color %= 16; } else { GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(circle.getAnimationCount() * 5F, 0.0F, 0.0F, 1.0F); } if (color == 9) { rainbow = true; } else { color %= 8; } tessellator.startDrawingQuads(); if (rainbow) { float rainbowTime = circle.ticksExisted / 3.0F; tessellator.setColorRGBA_F(MathHelper.sin(rainbowTime), MathHelper.cos(rainbowTime), -MathHelper.sin(rainbowTime) * 2F, 1.0F); } else { tessellator.setColorRGBA_F(colorR[color], colorG[color], colorB[color], 1.0F); } tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV(-0.6F, -0.6F, 0.0D, umin, vmax); tessellator.addVertexWithUV(0.6F, -0.6F, 0.0D, umax, vmax); tessellator.addVertexWithUV(0.6F, 0.6F, 0.0D, umax, vmin); tessellator.addVertexWithUV(-0.6F, 0.6F, 0.0D, umin, vmin); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }